Merge branch 'main' of github.com:danielmiessler/fabric

This commit is contained in:
Daniel Miessler 2024-05-30 14:12:37 -07:00
commit 62d3ba9fe2
6 changed files with 64 additions and 20 deletions

View File

@ -53,14 +53,11 @@
<br />
> [!NOTE]
> We are adding functionality to the project so often that you should update often as well. That means: `git pull; pipx install . --force; fabric --update; source ~/.zshrc (or ~/.bashrc)` in the main directory!
**April 21, 2024** — We now have context in Fabric, so you can build on previous queries! Be sure to update and check `fabric -h` for the latest!
> May 23, 2024 — We will be switching Fabric to Go in a few weeks to avoid all the installation issues with Python. The Go version will be dead-simple to install and will be even faster. Plus easier to update. We already have it working thanks to the heroic efforts of @xssdoctor, and we're just working on testing now! Stay tuned for more info on the release date!
## Introduction videos
> [!NOTE]
> These videos use the `./setup.sh` install method, which is now replaced with the easier `pipx install .` method. Other than that everything else is still the same.
**NOTE**: These videos use the `./setup.sh` install method, which is now replaced with the easier `pipx install .` method. Other than that everything else is still the same.
<div align="center">
<a href="https://youtu.be/wPEyyigh10g">

View File

@ -8,9 +8,8 @@ from dotenv import load_dotenv
DEFAULT_CONFIG = "~/.config/fabric/.env"
PATH_KEY = "FABRIC_OUTPUT_PATH"
FM_KEY = "FABRIC_FRONTMATTER_TAGS"
DATE_FORMAT = "%Y-%m-%d"
load_dotenv(os.path.expanduser(DEFAULT_CONFIG))
DATE_FORMAT = os.getenv("SAVE_DATE_FORMAT", "%Y-%m-%d")
def main(tag, tags, silent, fabric):
out = os.getenv(PATH_KEY)
@ -31,15 +30,21 @@ def main(tag, tags, silent, fabric):
print(f"'{sys.argv[0]}' takes a single argument to tag your summary")
sys.exit(1)
yyyymmdd = datetime.now().strftime(DATE_FORMAT)
target = f"{out}{yyyymmdd}-{tag}.md"
if DATE_FORMAT:
yyyymmdd = datetime.now().strftime(DATE_FORMAT)
target = f"{out}{yyyymmdd}-{tag}.md"
else:
target = f"{out}{tag}.md"
# don't clobber existing files- add an incremented number to the end instead
would_clobber = True
inc = 0
while would_clobber:
if inc > 0:
target = f"{out}{yyyymmdd}-{tag}-{inc}.md"
if DATE_FORMAT:
target = f"{out}{yyyymmdd}-{tag}-{inc}.md"
else:
target = f"{out}{tag}-{inc}.md"
if os.path.exists(target):
inc += 1
else:
@ -49,12 +54,12 @@ def main(tag, tags, silent, fabric):
# Prevent a NoneType ending up in the tags
frontmatter_tags = ""
if fabric:
frontmatter_tags = os.getenv(FM_KEY)
frontmatter_tags = os.getenv(FM_KEY) or ""
with open(target, "w") as fp:
if frontmatter_tags or len(tags) != 0:
fp.write("---\n")
now = datetime.now().strftime(f"{DATE_FORMAT} %H:%M")
now = datetime.now().strftime(f"%Y-%m-%d %H:%M")
fp.write(f"generation_date: {now}\n")
fp.write(f"tags: {frontmatter_tags} {tag} {' '.join(tags)}\n")
fp.write("---\n")

View File

@ -1,4 +1,4 @@
# Analize answers for the given question
# Analyze answers for the given question
This pattern is the complementary part of the `create_quiz` pattern. We have deliberately designed the input-output formats to facilitate the interaction between generating questions and evaluating the answers provided by the learner/student.

View File

@ -0,0 +1,42 @@
# IDENTITY and PURPOSE
You are a neutral and objective entity whose sole purpose is to help humans understand debates to broaden their own views.
You will be provided with the transcript of a debate.
Take a deep breath and think step by step about how to best accomplish this goal using the following steps.
# STEPS
- Consume the entire debate and think deeply about it.
- Map out all the claims and implications on a virtual whiteboard in your mind.
- Analyze the claims from a neutral and unbiased perspective.
# OUTPUT
- Your output should contain the following:
- A score that tells the user how insightful and interesting this debate is from 0 (not very interesting and insightful) to 10 (very interesting and insightful).
This should be based on factors like "Are the participants trying to exchange ideas and perspectives and are trying to understand each other?", "Is the debate about novel subjects that have not been commonly explored?" or "Have the participants reached some agreement?".
Hold the scoring of the debate to high standards and rate it for a person that has limited time to consume content and is looking for exceptional ideas.
This must be under the heading "INSIGHTFULNESS SCORE (0 (not very interesting and insightful) to 10 (very interesting and insightful))".
- A rating of how emotional the debate was from 0 (very calm) to 5 (very emotional). This must be under the heading "EMOTIONALITY SCORE (0 (very calm) to 5 (very emotional))".
- A list of the participants of the debate and a score of their emotionality from 0 (very calm) to 5 (very emotional). This must be under the heading "PARTICIPANTS".
- A list of arguments attributed to participants with names and quotes. If possible, this should include external references that disprove or back up their claims.
It is IMPORTANT that these references are from trusted and verifiable sources that can be easily accessed. These sources have to BE REAL and NOT MADE UP. This must be under the heading "ARGUMENTS".
If possible, provide an objective assessment of the truth of these arguments. If you assess the truth of the argument, provide some sources that back up your assessment. The material you provide should be from reliable, verifiable, and trustworthy sources. DO NOT MAKE UP SOURCES.
- A list of agreements the participants have reached, attributed with names and quotes. This must be under the heading "AGREEMENTS".
- A list of disagreements the participants were unable to resolve and the reasons why they remained unresolved, attributed with names and quotes. This must be under the heading "DISAGREEMENTS".
- A list of possible misunderstandings and why they may have occurred, attributed with names and quotes. This must be under the heading "POSSIBLE MISUNDERSTANDINGS".
- A list of learnings from the debate. This must be under the heading "LEARNINGS".
- A list of takeaways that highlight ideas to think about, sources to explore, and actionable items. This must be under the heading "TAKEAWAYS".
# OUTPUT INSTRUCTIONS
- Output all sections above.
- Use Markdown to structure your output.
- When providing quotes, these quotes should clearly express the points you are using them for. If necessary, use multiple quotes.
# INPUT:
INPUT:

10
poetry.lock generated
View File

@ -5467,13 +5467,13 @@ files = [
[[package]]
name = "requests"
version = "2.31.0"
version = "2.32.1"
description = "Python HTTP for Humans."
optional = false
python-versions = ">=3.7"
python-versions = ">=3.8"
files = [
{file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"},
{file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"},
{file = "requests-2.32.1-py3-none-any.whl", hash = "sha256:21ac9465cdf8c1650fe1ecde8a71669a93d4e6f147550483a2967d08396a56a5"},
{file = "requests-2.32.1.tar.gz", hash = "sha256:eb97e87e64c79e64e5b8ac75cee9dd1f97f49e289b083ee6be96268930725685"},
]
[package.dependencies]
@ -7101,4 +7101,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
[metadata]
lock-version = "2.0"
python-versions = ">=3.10,<3.13"
content-hash = "20b4784977b09b2d3ce41679356d7096938b70d3b326fcc54837043e83538e15"
content-hash = "2811de5c4bf9668c4a2121b6430ecac30ee1470be6562222e6c8d9cada8346eb"

View File

@ -34,7 +34,7 @@ google-generativeai = "^0.5.3"
[tool.poetry.group.cli.dependencies]
pyyaml = "^6.0.1"
requests = "^2.31.0"
requests = "^2.32.0"
python-socketio = "^5.11.0"
websocket-client = "^1.7.0"
flask = "^3.0.2"
@ -51,7 +51,7 @@ httpx = ">=0.25.2,<0.26.0"
tqdm = "^4.66.3"
[tool.poetry.group.server.dependencies]
requests = "^2.31.0"
requests = "^2.32.0"
openai = "^1.12.0"
flask = "^3.0.2"
python-dotenv = "1.0.0"