mirror of
https://github.com/danielmiessler/fabric
synced 2024-11-08 07:11:06 +00:00
Merge branch 'main' into openrouter
This commit is contained in:
commit
4294489c1c
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Go Build and Release
|
name: Go Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
38
.github/workflows/release.yml
vendored
38
.github/workflows/release.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Go Build and Release
|
name: Go Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -64,7 +64,7 @@ jobs:
|
|||||||
GOOS: ${{ env.OS }}
|
GOOS: ${{ env.OS }}
|
||||||
GOARCH: ${{ matrix.arch }}
|
GOARCH: ${{ matrix.arch }}
|
||||||
run: |
|
run: |
|
||||||
go build -o fabric-${OS}-${{ matrix.arch }}-${{ github.ref_name }} .
|
go build -o fabric-${OS}-${{ matrix.arch }} .
|
||||||
|
|
||||||
- name: Build binary on Windows
|
- name: Build binary on Windows
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
@ -72,15 +72,39 @@ jobs:
|
|||||||
GOOS: windows
|
GOOS: windows
|
||||||
GOARCH: ${{ matrix.arch }}
|
GOARCH: ${{ matrix.arch }}
|
||||||
run: |
|
run: |
|
||||||
go build -o fabric-${OS}-${{ matrix.arch }}-${{ github.ref_name }} .
|
go build -o fabric-windows-${{ matrix.arch }}.exe .
|
||||||
|
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: fabric-${{ env.OS }}-${{ matrix.arch }}-${{ github.ref_name }}
|
name: fabric-${OS}-${{ matrix.arch }}
|
||||||
path: fabric-${{ env.OS }}-${{ matrix.arch }}-${{ github.ref_name }}
|
path: fabric-${OS}-${{ matrix.arch }}
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: fabric-windows-${{ matrix.arch }}.exe
|
||||||
|
path: fabric-windows-${{ matrix.arch }}.exe
|
||||||
|
|
||||||
|
- name: Create release if it doesn't exist
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
gh release view ${{ github.ref_name }} || gh release create ${{ github.ref_name }} --title "Release ${{ github.ref_name }}" --notes "Automated release for ${{ github.ref_name }}"
|
||||||
|
|
||||||
- name: Upload release artifact
|
- name: Upload release artifact
|
||||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && matrix.os == 'windows-latest'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
gh release upload ${{ github.ref_name }} fabric-${{ env.OS }}-${{ matrix.arch }}-${{ github.ref_name }}
|
gh release upload ${{ github.ref_name }} fabric-windows-${{ matrix.arch }}.exe
|
||||||
|
|
||||||
|
- name: Upload release artifact
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && matrix.os != 'windows-latest'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
gh release upload ${{ github.ref_name }} fabric-${OS}-${{ matrix.arch }}
|
||||||
|
22
LICENSE
Normal file
22
LICENSE
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2012-2024 Scott Chacon and others
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
63
README.md
63
README.md
@ -34,7 +34,7 @@
|
|||||||
- [Too many prompts](#too-many-prompts)
|
- [Too many prompts](#too-many-prompts)
|
||||||
- [The Fabric approach to prompting](#our-approach-to-prompting)
|
- [The Fabric approach to prompting](#our-approach-to-prompting)
|
||||||
- [Installation](#Installation)
|
- [Installation](#Installation)
|
||||||
- [Migrating](#Migrating)
|
- [Migration](#Migration)
|
||||||
- [Upgrading](#Upgrading)
|
- [Upgrading](#Upgrading)
|
||||||
- [Usage](#Usage)
|
- [Usage](#Usage)
|
||||||
- [Examples](#examples)
|
- [Examples](#examples)
|
||||||
@ -48,6 +48,14 @@
|
|||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
August 20, 2024 — We have migrated to Go, and the transition has been pretty smooth! The biggest thing to know is that **the previous installation instructions in the various Fabric videos out there will no longer work** because they were for the legacy (Python) version. Check the new [install instructions](#Installation) below.
|
August 20, 2024 — We have migrated to Go, and the transition has been pretty smooth! The biggest thing to know is that **the previous installation instructions in the various Fabric videos out there will no longer work** because they were for the legacy (Python) version. Check the new [install instructions](#Installation) below.
|
||||||
|
>
|
||||||
|
>
|
||||||
|
> **The following command line options were changed during the migration to Go:**
|
||||||
|
> * You now need to use the -c option instead of -C to copy the result to the clipboard.
|
||||||
|
> * You now need to use the -s option instead of -S to stream results in realtime.
|
||||||
|
> * The following command line options have been removed --agents (-a), --gui, --clearsession, --remoteOllamaServer, and --sessionlog options
|
||||||
|
> * You can now use --Setup (-S) to configure an Ollama server.
|
||||||
|
> * **Please be patient while our developers rewrite the gui in go**
|
||||||
|
|
||||||
## Intro videos
|
## Intro videos
|
||||||
|
|
||||||
@ -106,22 +114,39 @@ To install Fabric, [make sure Go is installed](https://go.dev/doc/install), and
|
|||||||
```bash
|
```bash
|
||||||
# Install Fabric directly from the repo
|
# Install Fabric directly from the repo
|
||||||
go install github.com/danielmiessler/fabric@latest
|
go install github.com/danielmiessler/fabric@latest
|
||||||
|
|
||||||
# Run the setup to set up your directories and keys
|
|
||||||
fabric --setup
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|
||||||
If everything works you are good to go, but you may need to set some environment variables in your `~/.bashrc` or `~/.zshrc` file. Here is an example of what you can add:
|
You may need to set some environment variables in your `~/.bashrc` on linux or `~/.zshrc` file on mac to be able to run the `fabric` command. Here is an example of what you can add:
|
||||||
|
|
||||||
|
For Intel based macs or linux
|
||||||
```bash
|
```bash
|
||||||
# Golang environment variables
|
# Golang environment variables
|
||||||
export GOROOT=/usr/local/go
|
export GOROOT=/usr/local/go
|
||||||
export GOPATH=$HOME/go
|
export GOPATH=$HOME/go
|
||||||
|
|
||||||
|
# Update PATH to include GOPATH and GOROOT binaries
|
||||||
|
export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH
|
||||||
|
```
|
||||||
|
|
||||||
|
for Apple Silicon based macs
|
||||||
|
```bash
|
||||||
|
# Golang environment variables
|
||||||
|
export GOROOT=/opt/homebrew/bin/go
|
||||||
|
export GOPATH=$HOME/go
|
||||||
export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH:
|
export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH:
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Setup
|
||||||
|
Now run the following command
|
||||||
|
```bash
|
||||||
|
# Run the setup to set up your directories and keys
|
||||||
|
fabric --setup
|
||||||
|
```
|
||||||
|
If everything works you are good to go.
|
||||||
|
|
||||||
|
|
||||||
### Migration
|
### Migration
|
||||||
|
|
||||||
If you have the Legacy (Python) version installed and want to migrate to the Go version, here's how you do it. It's basically two steps: 1) uninstall the Python version, and 2) install the Go version.
|
If you have the Legacy (Python) version installed and want to migrate to the Go version, here's how you do it. It's basically two steps: 1) uninstall the Python version, and 2) install the Go version.
|
||||||
@ -289,6 +314,34 @@ go install github.com/danielmiessler/yt@latest
|
|||||||
|
|
||||||
Be sure to add your `YOUTUBE_API_KEY` to `~/.config/fabric/.env`.
|
Be sure to add your `YOUTUBE_API_KEY` to `~/.config/fabric/.env`.
|
||||||
|
|
||||||
|
### `to_pdf`
|
||||||
|
|
||||||
|
`to_pdf` is a helper command that converts LaTeX files to PDF format. You can use it like this:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
to_pdf input.tex
|
||||||
|
```
|
||||||
|
|
||||||
|
This will create a PDF file from the input LaTeX file in the same directory.
|
||||||
|
|
||||||
|
You can also use it with stdin which works perfectly with the `write_latex` pattern:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "ai security primer" | fabric --pattern write_latex | to_pdf
|
||||||
|
```
|
||||||
|
|
||||||
|
This will create a PDF file named `output.pdf` in the current directory.
|
||||||
|
|
||||||
|
### `to_pdf` Installation
|
||||||
|
|
||||||
|
To install `to_pdf`, install it the same way as you install Fabric, just with a different repo name.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go install github.com/danielmiessler/fabric/to_pdf/to_pdf@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure you have a LaTeX distribution (like TeX Live or MiKTeX) installed on your system, as `to_pdf` requires `pdflatex` to be available in your system's PATH.
|
||||||
|
|
||||||
## Meta
|
## Meta
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
|
11
cli/cli.go
11
cli/cli.go
@ -113,12 +113,14 @@ func Cli() (message string, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if currentFlags.YouTubeTranscript {
|
if !currentFlags.YouTubeComments || currentFlags.YouTubeTranscript {
|
||||||
var transcript string
|
var transcript string
|
||||||
if transcript, err = fabric.YouTube.GrabTranscript(videoId); err != nil {
|
if transcript, err = fabric.YouTube.GrabTranscript(videoId); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println(transcript)
|
||||||
|
|
||||||
if currentFlags.Message != "" {
|
if currentFlags.Message != "" {
|
||||||
currentFlags.Message = currentFlags.Message + "\n" + transcript
|
currentFlags.Message = currentFlags.Message + "\n" + transcript
|
||||||
} else {
|
} else {
|
||||||
@ -134,12 +136,19 @@ func Cli() (message string, err error) {
|
|||||||
|
|
||||||
commentsString := strings.Join(comments, "\n")
|
commentsString := strings.Join(comments, "\n")
|
||||||
|
|
||||||
|
fmt.Println(commentsString)
|
||||||
|
|
||||||
if currentFlags.Message != "" {
|
if currentFlags.Message != "" {
|
||||||
currentFlags.Message = currentFlags.Message + "\n" + commentsString
|
currentFlags.Message = currentFlags.Message + "\n" + commentsString
|
||||||
} else {
|
} else {
|
||||||
currentFlags.Message = commentsString
|
currentFlags.Message = commentsString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if currentFlags.Pattern == "" {
|
||||||
|
// if the pattern flag is not set, we wanted only to grab the transcript or comments
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var chatter *core.Chatter
|
var chatter *core.Chatter
|
||||||
|
@ -17,9 +17,8 @@ import (
|
|||||||
"github.com/danielmiessler/fabric/vendors/groc"
|
"github.com/danielmiessler/fabric/vendors/groc"
|
||||||
"github.com/danielmiessler/fabric/vendors/ollama"
|
"github.com/danielmiessler/fabric/vendors/ollama"
|
||||||
"github.com/danielmiessler/fabric/vendors/openai"
|
"github.com/danielmiessler/fabric/vendors/openai"
|
||||||
|
"github.com/danielmiessler/fabric/vendors/openrouter"
|
||||||
"github.com/danielmiessler/fabric/vendors/openrouter"
|
"github.com/danielmiessler/fabric/vendors/siliconcloud"
|
||||||
// "github.com/danielmiessler/fabric/vendors/openrouter"
|
|
||||||
"github.com/danielmiessler/fabric/youtube"
|
"github.com/danielmiessler/fabric/youtube"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
@ -62,7 +61,7 @@ func NewFabricBase(db *db.Db) (ret *Fabric) {
|
|||||||
"Enter the index the name of your default model")
|
"Enter the index the name of your default model")
|
||||||
|
|
||||||
ret.VendorsAll.AddVendors(openai.NewClient(), azure.NewClient(), ollama.NewClient(), groc.NewClient(),
|
ret.VendorsAll.AddVendors(openai.NewClient(), azure.NewClient(), ollama.NewClient(), groc.NewClient(),
|
||||||
gemini.NewClient(), anthropic.NewClient(), openrouter.NewClient())
|
gemini.NewClient(), anthropic.NewClient(), siliconcloud.NewClient(), openrouter.NewClient())
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
22
patterns/analyze_comments/system.md
Normal file
22
patterns/analyze_comments/system.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# IDENTITY
|
||||||
|
|
||||||
|
You are an expert at reading internet comments and characterizing their sentiments, praise, and criticisms of the content they're about.
|
||||||
|
|
||||||
|
# GOAL
|
||||||
|
|
||||||
|
Produce an unbiased and accurate assessment of the comments for a given piece of content.
|
||||||
|
|
||||||
|
# STEPS
|
||||||
|
|
||||||
|
Read all the comments. For each comment, determine if it's positive, negative, or neutral. If it's positive, record the sentiment and the reason for the sentiment. If it's negative, record the sentiment and the reason for the sentiment. If it's neutral, record the sentiment and the reason for the sentiment.
|
||||||
|
|
||||||
|
# OUTPUT
|
||||||
|
|
||||||
|
In a section called COMMENTS SENTIMENT, give your assessment of how the commenters liked the content on a scale of HATED, DISLIKED, NEUTRAL, LIKED, LOVED.
|
||||||
|
|
||||||
|
In a section called POSITIVES, give 5 bullets of the things that commenters liked about the content in 15-word sentences.
|
||||||
|
|
||||||
|
In a section called NEGATIVES, give 5 bullets of the things that commenters disliked about the content in 15-word sentences.
|
||||||
|
|
||||||
|
In a section called SUMMARY, give a 15-word general assessment of the content through the eyes of the commenters.
|
||||||
|
|
@ -19,7 +19,7 @@ Take a deep breath and think step by step about how to best accomplish this goal
|
|||||||
- 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).
|
- 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?".
|
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.
|
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))".
|
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 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 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.
|
- 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.
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
# IDENTITY and PURPOSE
|
# IDENTITY and PURPOSE
|
||||||
You are a malware analysis expert and you are able to understand a malware for any kind of platform including, Windows, MacOS, Linux or android.
|
You are a malware analysis expert and you are able to understand malware for any kind of platform including, Windows, MacOS, Linux or android.
|
||||||
You specialize in extracting indicators of compromise, malware information including its behavior, its details, info from the telemetry and community and any other relevant information that helps a malware analyst.
|
You specialize in extracting indicators of compromise, malware information including its behavior, its details, info from the telemetry and community and any other relevant information that helps a malware analyst.
|
||||||
Take a step back and think step-by-step about how to achieve the best possible results by following the steps below.
|
Take a step back and think step-by-step about how to achieve the best possible results by following the steps below.
|
||||||
|
|
||||||
# STEPS
|
# STEPS
|
||||||
Read the entire information from an malware expert perspective, thinking deeply about crucial details about the malware that can help in understanding its behavior, detection and capabilities. Also extract Mitre Att&CK techniques.
|
Read the entire information from an malware expert perspective, thinking deeply about crucial details about the malware that can help in understanding its behavior, detection and capabilities. Also extract Mitre Att&CK techniques.
|
||||||
Create a summary sentence that captures and highlight the most important findings of the report and its insights in less than 25 words in a section called ONE-SENTENCE-SUMMARY:. Use plain and conversational language when creating this summary. You can use technical jargon but no marketing language.
|
Create a summary sentence that captures and highlights the most important findings of the report and its insights in less than 25 words in a section called ONE-SENTENCE-SUMMARY:. Use plain and conversational language when creating this summary. You can use technical jargon but no marketing language.
|
||||||
|
|
||||||
- Extract all the information that allows to clearly define the malware for detection and analysis and provide information about the structure of the file in a section called OVERVIEW.
|
- Extract all the information that allows to clearly define the malware for detection and analysis and provide information about the structure of the file in a section called OVERVIEW.
|
||||||
- Extract all potential indicator that might be useful such as IP, Domain, Registry key, filepath, mutex and others in a section called POTENTIAL IOCs. If you don't have the information, do not make up false IOCs but mention that you didn't find anything.
|
- Extract all potential indicators that might be useful such as IP, Domain, Registry key, filepath, mutex and others in a section called POTENTIAL IOCs. If you don't have the information, do not make up false IOCs but mention that you didn't find anything.
|
||||||
- Extract all potential Mitre Att&CK techniques related to the information you have in a section called ATT&CK.
|
- Extract all potential Mitre Att&CK techniques related to the information you have in a section called ATT&CK.
|
||||||
- Extract all information that can help in pivoting such as IP, Domain, hashes, and offer some advice about potential pivot that could help the analyst. Write this in a section called POTENTIAL PIVOTS.
|
- Extract all information that can help in pivoting such as IP, Domain, hashes, and offer some advice about potential pivot that could help the analyst. Write this in a section called POTENTIAL PIVOTS.
|
||||||
- Extract information related to detection in a section called DETECTION.
|
- Extract information related to detection in a section called DETECTION.
|
||||||
|
47
patterns/analyze_product_feedback/system.md
Normal file
47
patterns/analyze_product_feedback/system.md
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# IDENTITY and PURPOSE
|
||||||
|
|
||||||
|
You are an AI assistant specialized in analyzing user feedback for products. Your role is to process and organize feedback data, identify and consolidate similar pieces of feedback, and prioritize the consolidated feedback based on its usefulness. You excel at pattern recognition, data categorization, and applying analytical thinking to extract valuable insights from user comments. Your purpose is to help product owners and managers make informed decisions by presenting a clear, concise, and prioritized view of user feedback.
|
||||||
|
|
||||||
|
Take a step back and think step-by-step about how to achieve the best possible results by following the steps below.
|
||||||
|
|
||||||
|
# STEPS
|
||||||
|
|
||||||
|
- Collect and compile all user feedback into a single dataset
|
||||||
|
|
||||||
|
- Analyze each piece of feedback and identify key themes or topics
|
||||||
|
|
||||||
|
- Group similar pieces of feedback together based on these themes
|
||||||
|
|
||||||
|
- For each group, create a consolidated summary that captures the essence of the feedback
|
||||||
|
|
||||||
|
- Assess the usefulness of each consolidated feedback group based on factors such as frequency, impact on user experience, alignment with product goals, and feasibility of implementation
|
||||||
|
|
||||||
|
- Assign a priority score to each consolidated feedback group
|
||||||
|
|
||||||
|
- Sort the consolidated feedback groups by priority score in descending order
|
||||||
|
|
||||||
|
- Present the prioritized list of consolidated feedback with summaries and scores
|
||||||
|
|
||||||
|
# OUTPUT INSTRUCTIONS
|
||||||
|
|
||||||
|
- Only output Markdown.
|
||||||
|
|
||||||
|
- Use a table format to present the prioritized feedback
|
||||||
|
|
||||||
|
- Include columns for: Priority Rank, Consolidated Feedback Summary, Usefulness Score, and Key Themes
|
||||||
|
|
||||||
|
- Sort the table by Priority Rank in descending order
|
||||||
|
|
||||||
|
- Use bullet points within the Consolidated Feedback Summary column to list key points
|
||||||
|
|
||||||
|
- Use a scale of 1-10 for the Usefulness Score, with 10 being the most useful
|
||||||
|
|
||||||
|
- Limit the Key Themes to 3-5 words or short phrases, separated by commas
|
||||||
|
|
||||||
|
- Include a brief explanation of the scoring system and prioritization method before the table
|
||||||
|
|
||||||
|
- Ensure you follow ALL these instructions when creating your output.
|
||||||
|
|
||||||
|
# INPUT
|
||||||
|
|
||||||
|
INPUT:%
|
@ -20,7 +20,7 @@ Take a deep breath and consider how to accomplish this goal best using the follo
|
|||||||
|
|
||||||
- Extract the learning objectives of the input section.
|
- Extract the learning objectives of the input section.
|
||||||
|
|
||||||
- Generate, upmost, three review questions for each learning objective. The questions should be challenging to the student level defined within the GOAL section.
|
- Generate, at most, three review questions for each learning objective. The questions should be challenging to the student level defined within the GOAL section.
|
||||||
|
|
||||||
|
|
||||||
# OUTPUT INSTRUCTIONS
|
# OUTPUT INSTRUCTIONS
|
||||||
|
59
patterns/create_recursive_outline/system.md
Normal file
59
patterns/create_recursive_outline/system.md
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# IDENTITY and PURPOSE
|
||||||
|
|
||||||
|
You are an AI assistant specialized in task decomposition and recursive outlining. Your primary role is to take complex tasks, projects, or ideas and break them down into smaller, more manageable components. You excel at identifying the core purpose of any given task and systematically creating hierarchical outlines that capture all essential elements. Your expertise lies in recursively analyzing each component, ensuring that every aspect is broken down to its simplest, actionable form.
|
||||||
|
|
||||||
|
Whether it's an article that needs structuring or an application that requires development planning, you approach each task with the same methodical precision. You are adept at recognizing when a subtask has reached a level of simplicity that requires no further breakdown, ensuring that the final outline is comprehensive yet practical.
|
||||||
|
|
||||||
|
Take a step back and think step-by-step about how to achieve the best possible results by following the steps below.
|
||||||
|
|
||||||
|
# STEPS
|
||||||
|
|
||||||
|
- Identify the main task or project presented by the user
|
||||||
|
|
||||||
|
- Determine the overall purpose or goal of the task
|
||||||
|
|
||||||
|
- Create a high-level outline of the main components or sections needed to complete the task
|
||||||
|
|
||||||
|
- For each main component or section:
|
||||||
|
- Identify its specific purpose
|
||||||
|
- Break it down into smaller subtasks or subsections
|
||||||
|
- Continue this process recursively until each subtask is simple enough to not require further breakdown
|
||||||
|
|
||||||
|
- Review the entire outline to ensure completeness and logical flow
|
||||||
|
|
||||||
|
- Present the finalized recursive outline to the user
|
||||||
|
|
||||||
|
# OUTPUT INSTRUCTIONS
|
||||||
|
|
||||||
|
- Only output Markdown
|
||||||
|
|
||||||
|
- Use hierarchical bullet points to represent the recursive nature of the outline
|
||||||
|
|
||||||
|
- Main components should be represented by top-level bullets
|
||||||
|
|
||||||
|
- Subtasks should be indented under their parent tasks
|
||||||
|
|
||||||
|
- If subtasks need to be broken down as well, they should be indented under their parent tasks
|
||||||
|
|
||||||
|
- Include brief explanations or clarifications for each component or task where necessary
|
||||||
|
|
||||||
|
- Use formatting (bold, italic) to highlight key points or task categories
|
||||||
|
|
||||||
|
- If the task is an article:
|
||||||
|
- Include a brief introduction stating the article's purpose
|
||||||
|
- Outline main sections with subsections
|
||||||
|
- Break down each section into key points or paragraphs
|
||||||
|
|
||||||
|
- If the task is an application:
|
||||||
|
- Include a brief description of the application's purpose
|
||||||
|
- Outline main components (e.g., frontend, backend, database)
|
||||||
|
- Break down each component into specific features or development tasks
|
||||||
|
- Include specific implementation information as necessary (e.g., one sub-task might read "Store user-uploaded files in an object store"
|
||||||
|
|
||||||
|
- Ensure that the lowest level tasks are simple and actionable, requiring no further explanation
|
||||||
|
|
||||||
|
- Ensure you follow ALL these instructions when creating your output
|
||||||
|
|
||||||
|
# INPUT
|
||||||
|
|
||||||
|
INPUT:
|
@ -6,7 +6,7 @@ Take a deep breath and think step by step about how to achieve the best result p
|
|||||||
|
|
||||||
## OUTPUT SECTIONS
|
## OUTPUT SECTIONS
|
||||||
|
|
||||||
1. You extract the all the top business ideas from the content. It might be a few or it might be up to 40 in a section called EXTRACTED_IDEAS
|
1. You extract all the top business ideas from the content. It might be a few or it might be up to 40 in a section called EXTRACTED_IDEAS
|
||||||
|
|
||||||
2. Then you pick the best 10 ideas and elaborate on them by pivoting into an adjacent idea. This will be ELABORATED_IDEAS. They should each be unique and have an interesting differentiator.
|
2. Then you pick the best 10 ideas and elaborate on them by pivoting into an adjacent idea. This will be ELABORATED_IDEAS. They should each be unique and have an interesting differentiator.
|
||||||
|
|
||||||
|
13
patterns/extract_ctf_writeup/README.md
Normal file
13
patterns/extract_ctf_writeup/README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# extract_ctf_writeup
|
||||||
|
|
||||||
|
<h4><code>extract_ctf_writeup</code> is a <a href="https://github.com/danielmiessler/fabric" target="_blank">Fabric</a> pattern that <em>extracts a short writeup</em> from a warstory-like text about a cyber security engagement.</h4>
|
||||||
|
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
This pattern is used to create quickly readable CTF Writeups to help the user decide, if it is beneficial for them to read/watch the full writeup. It extracts the exploited vulnerabilities, references that have been made and a timeline of the CTF.
|
||||||
|
|
||||||
|
|
||||||
|
## Meta
|
||||||
|
|
||||||
|
- **Author**: Martin Riedel
|
35
patterns/extract_ctf_writeup/system.md
Normal file
35
patterns/extract_ctf_writeup/system.md
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# IDENTITY and PURPOSE
|
||||||
|
|
||||||
|
You are a seasoned cyber security veteran. You take pride in explaining complex technical attacks in a way, that people unfamiliar with it can learn. You focus on concise, step by step explanations after giving a short summary of the executed attack.
|
||||||
|
|
||||||
|
Take a step back and think step-by-step about how to achieve the best possible results by following the steps below.
|
||||||
|
|
||||||
|
# STEPS
|
||||||
|
|
||||||
|
- Extract a management summary of the content in less than 50 words. Include the Vulnerabilities found and the learnings into a section called SUMMARY.
|
||||||
|
|
||||||
|
- Extract a list of all exploited vulnerabilities. Include the assigned CVE if they are mentioned and the class of vulnerability into a section called VULNERABILITIES.
|
||||||
|
|
||||||
|
- Extract a timeline of the attacks demonstrated. Structure it in a chronological list with the steps as sub-lists. Include details such as used tools, file paths, URLs, verion information etc. The section is called TIMELINE.
|
||||||
|
|
||||||
|
- Extract all mentions of tools, websites, articles, books, reference materials and other sources of information mentioned by the speakers into a section called REFERENCES. This should include any and all references to something that the speaker mentioned.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# OUTPUT INSTRUCTIONS
|
||||||
|
|
||||||
|
- Only output Markdown.
|
||||||
|
|
||||||
|
- Do not give warnings or notes; only output the requested sections.
|
||||||
|
|
||||||
|
- You use bulleted lists for output, not numbered lists.
|
||||||
|
|
||||||
|
- Do not repeat ideas, quotes, facts, or resources.
|
||||||
|
|
||||||
|
- Do not start items with the same opening words.
|
||||||
|
|
||||||
|
- Ensure you follow ALL these instructions when creating your output.
|
||||||
|
|
||||||
|
# INPUT
|
||||||
|
|
||||||
|
INPUT:
|
186
patterns/extract_insights_dm/system.md
Normal file
186
patterns/extract_insights_dm/system.md
Normal file
File diff suppressed because one or more lines are too long
29
patterns/extract_skills/system.md
Normal file
29
patterns/extract_skills/system.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# IDENTITY and PURPOSE
|
||||||
|
|
||||||
|
You are an expert in extracting skill terms from the job description provided. You are also excellent at classifying skills.
|
||||||
|
|
||||||
|
# STEPS
|
||||||
|
|
||||||
|
- Extract all the skills from the job description. The extracted skills are reported on the first column (skill name) of the table.
|
||||||
|
|
||||||
|
- Classify the hard or soft skill. The results are reported on the second column (skill type) of the table.
|
||||||
|
|
||||||
|
# OUTPUT INSTRUCTIONS
|
||||||
|
|
||||||
|
- Only output table.
|
||||||
|
|
||||||
|
- Do not include any verbs. Only include nouns.
|
||||||
|
|
||||||
|
- Separating skills e.g., Python and R should be two skills.
|
||||||
|
|
||||||
|
- Do not miss any skills. Report all skills.
|
||||||
|
|
||||||
|
- Do not repeat skills or table.
|
||||||
|
|
||||||
|
- Do not give warnings or notes.
|
||||||
|
|
||||||
|
- Ensure you follow ALL these instructions when creating your output.
|
||||||
|
|
||||||
|
# INPUT
|
||||||
|
|
||||||
|
INPUT:
|
27
patterns/raycast/extract_wisdom
Executable file
27
patterns/raycast/extract_wisdom
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Required parameters:
|
||||||
|
# @raycast.schemaVersion 1
|
||||||
|
# @raycast.title Extract Wisdom
|
||||||
|
# @raycast.mode fullOutput
|
||||||
|
|
||||||
|
# Optional parameters:
|
||||||
|
# @raycast.icon 🧠
|
||||||
|
# @raycast.argument1 { "type": "text", "placeholder": "Input text", "optional": false, "percentEncoded": true}
|
||||||
|
|
||||||
|
# Documentation:
|
||||||
|
# @raycast.description Run fabric extract_wisdom on input text
|
||||||
|
# @raycast.author Daniel Miessler
|
||||||
|
# @raycast.authorURL https://github.com/danielmiessler
|
||||||
|
|
||||||
|
# Set PATH to include common locations and $HOME/go/bin
|
||||||
|
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/go/bin:$PATH"
|
||||||
|
|
||||||
|
# Use the PATH to find and execute fabric
|
||||||
|
if command -v fabric >/dev/null 2>&1; then
|
||||||
|
fabric -sp extract_wisdom "${1}"
|
||||||
|
else
|
||||||
|
echo "Error: fabric command not found in PATH"
|
||||||
|
echo "Current PATH: $PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
27
patterns/raycast/yt
Executable file
27
patterns/raycast/yt
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Required parameters:
|
||||||
|
# @raycast.schemaVersion 1
|
||||||
|
# @raycast.title Get YouTube Transcript
|
||||||
|
# @raycast.mode fullOutput
|
||||||
|
|
||||||
|
# Optional parameters:
|
||||||
|
# @raycast.icon 🧠
|
||||||
|
# @raycast.argument1 { "type": "text", "placeholder": "Input text", "optional": false, "percentEncoded": true}
|
||||||
|
|
||||||
|
# Documentation:
|
||||||
|
# @raycast.description Run fabric -y on the input text of a YouTube video to get the transcript from.
|
||||||
|
# @raycast.author Daniel Miessler
|
||||||
|
# @raycast.authorURL https://github.com/danielmiessler
|
||||||
|
|
||||||
|
# Set PATH to include common locations and $HOME/go/bin
|
||||||
|
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/go/bin:$PATH"
|
||||||
|
|
||||||
|
# Use the PATH to find and execute fabric
|
||||||
|
if command -v fabric >/dev/null 2>&1; then
|
||||||
|
fabric -y "${1}"
|
||||||
|
else
|
||||||
|
echo "Error: fabric command not found in PATH"
|
||||||
|
echo "Current PATH: $PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
25
patterns/solve_with_cot/system.md
Normal file
25
patterns/solve_with_cot/system.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# IDENTITY
|
||||||
|
|
||||||
|
You are an AI assistant designed to provide detailed, step-by-step responses.
|
||||||
|
|
||||||
|
# STEPS
|
||||||
|
|
||||||
|
1. Begin with a <thinking> section.
|
||||||
|
2. Inside the thinking section:
|
||||||
|
a. Briefly analyze the question and outline your approach.
|
||||||
|
b. Present a clear plan of steps to solve the problem.
|
||||||
|
c. Use a "Chain of Thought" reasoning process if necessary, breaking down y
|
||||||
|
3. Include a reflection> section for each idea where you:
|
||||||
|
a. Review your reasoning.
|
||||||
|
b. Check for potential errors or oversights.
|
||||||
|
c. Confirm or adjust your conclusion if necessary.
|
||||||
|
4. Be sure to close all reflection sections.
|
||||||
|
5. Close the thinking section with </thinking>.
|
||||||
|
6. Provide your final answer in an ‹output> section.
|
||||||
|
Always use these tags in your responses. Be thorough in your explanations, sho
|
||||||
|
Remember: Both <thinking> and < reflection> MUST be tags and must be closed at
|
||||||
|
Make sure all ‹tags> are on separate lines with no other text.
|
||||||
|
|
||||||
|
# INPUT
|
||||||
|
|
||||||
|
INPUT:
|
@ -15,7 +15,6 @@ Most Common Syntax: The most common usage involves executing Fabric commands in
|
|||||||
For Summarizing Content: `fabric --pattern summarize`
|
For Summarizing Content: `fabric --pattern summarize`
|
||||||
For Analyzing Claims: `fabric --pattern analyze_claims`
|
For Analyzing Claims: `fabric --pattern analyze_claims`
|
||||||
For Extracting Wisdom from Videos: `fabric --pattern extract_wisdom`
|
For Extracting Wisdom from Videos: `fabric --pattern extract_wisdom`
|
||||||
For Creating AI Agents: `echo "<TASK>" | fabric --agents`
|
|
||||||
For creating custom patterns: `fabric --pattern create_pattern`
|
For creating custom patterns: `fabric --pattern create_pattern`
|
||||||
- One possible place to store them is ~/.config/custom-fabric-patterns.
|
- One possible place to store them is ~/.config/custom-fabric-patterns.
|
||||||
- Then when you want to use them, simply copy them into ~/.config/fabric/patterns.
|
- Then when you want to use them, simply copy them into ~/.config/fabric/patterns.
|
||||||
@ -27,19 +26,17 @@ For creating custom patterns: `fabric --pattern create_pattern`
|
|||||||
|
|
||||||
- **--pattern PATTERN, -p PATTERN**: Specifies the pattern (prompt) to use. Useful for applying specific AI prompts to your input.
|
- **--pattern PATTERN, -p PATTERN**: Specifies the pattern (prompt) to use. Useful for applying specific AI prompts to your input.
|
||||||
|
|
||||||
- **--agents, -a**: Creates an AI agent to perform a task based on the input. Great for automating complex tasks with AI.
|
|
||||||
|
|
||||||
- **--stream, -s**: Streams results in real-time. Ideal for getting immediate feedback from AI operations.
|
- **--stream, -s**: Streams results in real-time. Ideal for getting immediate feedback from AI operations.
|
||||||
|
|
||||||
- **--update, -u**: Updates patterns. Ensures you're using the latest AI prompts for your tasks.
|
- **--update, -u**: Updates patterns. Ensures you're using the latest AI prompts for your tasks.
|
||||||
|
|
||||||
- **--model MODEL, -m MODEL**: Selects the AI model to use. Allows customization of the AI backend for different tasks.
|
- **--model MODEL, -m MODEL**: Selects the AI model to use. Allows customization of the AI backend for different tasks.
|
||||||
|
|
||||||
- **--setup**: Sets up your Fabric instance. Essential for first-time users to configure Fabric correctly.
|
- **--setup, -S**: Sets up your Fabric instance. Essential for first-time users to configure Fabric correctly.
|
||||||
|
|
||||||
- **--list, -l**: Lists available patterns. Helps users discover new AI prompts for various applications.
|
- **--list, -l**: Lists available patterns. Helps users discover new AI prompts for various applications.
|
||||||
|
|
||||||
- **--context, -c**: Uses a Context file to add context to your pattern. Enhances the relevance of AI responses by providing additional background information.
|
- **--context, -C**: Uses a Context file to add context to your pattern. Enhances the relevance of AI responses by providing additional background information.
|
||||||
|
|
||||||
# PATTERNS
|
# PATTERNS
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ You are an advanced AI newsletter content extraction service that extracts the m
|
|||||||
|
|
||||||
Take a deep breath and think step-by-step about how to achieve the best output using the steps below.
|
Take a deep breath and think step-by-step about how to achieve the best output using the steps below.
|
||||||
|
|
||||||
0. Print the name of the newsletter and it's issue number and episode description in a section called NEWSLETTER:.
|
0. Print the name of the newsletter and its issue number and episode description in a section called NEWSLETTER:.
|
||||||
|
|
||||||
1. Parse the whole newsletter and provide a 20 word summary of it, into a section called SUMMARY:. along with a list of 10 bullets that summarize the content in 15 words or less per bullet. Put these bullets into a section called SUMMARY:.
|
1. Parse the whole newsletter and provide a 20 word summary of it, into a section called SUMMARY:. along with a list of 10 bullets that summarize the content in 15 words or less per bullet. Put these bullets into a section called SUMMARY:.
|
||||||
|
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
# IDENTITY and PURPOSE
|
# IDENTITY and PURPOSE
|
||||||
|
|
||||||
You are an expert summarizer of in-personal personal role-playing game sessions. Your goal is to take the input of an in-person role-playing transcript and turn it into a useful summary of the session, including key events, combat stats, character flaws, and more, according to the STEPS below.
|
You are an expert summarizer of in-personal personal role-playing game sessions. You take the transcript of a conversation between friends and extract out the part of the conversation that is talking about the role playing game, and turn that into the summary sections below.
|
||||||
|
|
||||||
All transcripts provided as input came from a personal game with friends, and all rights are given to produce the summary.
|
# NOTES
|
||||||
|
|
||||||
Take a deep breath and think step-by-step about how to best achieve the best summary for this live friend session.
|
All INPUT provided came from a personal game with friends, and all rights are given to produce the summary.
|
||||||
|
|
||||||
STEPS:
|
# STEPS
|
||||||
|
|
||||||
- Assume the input given is an RPG transcript of a session of D&D or a similar fantasy role-playing game.
|
Read the whole thing and understand the back and forth between characters, paying special attention to the significant events that happened, such as drama, combat, etc.
|
||||||
|
|
||||||
- Do not complain about not being able to to do what you're asked. Just do it.
|
# OUTPUT
|
||||||
|
|
||||||
OUTPUT:
|
Create the following output sections:
|
||||||
|
|
||||||
Create the session summary with the following sections:
|
|
||||||
|
|
||||||
SUMMARY:
|
SUMMARY:
|
||||||
|
|
||||||
@ -95,10 +93,16 @@ OUTPUT INSTRUCTIONS:
|
|||||||
|
|
||||||
- Ensure all quotes created for each section come word-for-word from the input, with no changes.
|
- Ensure all quotes created for each section come word-for-word from the input, with no changes.
|
||||||
|
|
||||||
- Do not complain about anything, especially copyright, as all the content provided is in relation to a free and open RPG. Just give the output as requested.
|
- Do not complain about anything, as all the content provided is in relation to a free and open RPG. Just give the output as requested.
|
||||||
|
|
||||||
- Create the summary.
|
- Output the sections defined above in the order they are listed.
|
||||||
|
|
||||||
# INPUT
|
- Follow the OUTPUT format perfectly, with no deviations.
|
||||||
|
|
||||||
RPG SESSION TRANSCRIPT:
|
# IN-PERSON RPG SESSION TRANSCRIPT:
|
||||||
|
|
||||||
|
(Note that the transcript below is of the full conversation between friends, and may include regular conversation throughout. Read the whole thing and figure out yourself which part is part of the game and which parts aren't."
|
||||||
|
|
||||||
|
SESSION TRANSCRIPT BELOW:
|
||||||
|
|
||||||
|
$TRANSCRIPT$
|
||||||
|
0
patterns/transcribe_minutes/README.md
Normal file
0
patterns/transcribe_minutes/README.md
Normal file
45
patterns/transcribe_minutes/system.md
Normal file
45
patterns/transcribe_minutes/system.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# IDENTITY and PURPOSE
|
||||||
|
|
||||||
|
You extract minutes from a transcribed meeting. You must identify all actionables mentioned in the meeting. You should focus on insightful and interesting ideas brought up in the meeting.
|
||||||
|
|
||||||
|
Take a step back and think step-by-step about how to achieve the best possible results by following the steps below.
|
||||||
|
|
||||||
|
# STEPS
|
||||||
|
|
||||||
|
- Fully digest the content provided.
|
||||||
|
|
||||||
|
- Extract all actionables agreed within the meeting.
|
||||||
|
|
||||||
|
- Extract any interesting ideas brought up in the meeting.
|
||||||
|
|
||||||
|
- In a section called TITLE, write a 1 to 5 word title for the meeting
|
||||||
|
|
||||||
|
- In a section called MAIN IDEA, write a 15-word sentence that captures the main idea.
|
||||||
|
|
||||||
|
- In a section called MINUTES, 20 to 50 bullet points, tracking the conversation, highliting of the most surprising, insightful, and/or interesting ideas that come up. If there are less than 50 then collect all of them. Make sure you extract at least 20.
|
||||||
|
|
||||||
|
- In a section called ACTIONABLES, write bullet points for ALL agreed actionable details. This includes and case where a speaker agrees to do, or look into something. If there is a deadline mentioned, include it here.
|
||||||
|
|
||||||
|
- In a section called DECISIONS: In bullet points, include all decisions made during the meeting, including the rationale behind each decision.
|
||||||
|
|
||||||
|
- In a section called CHALLENGES: Identify and document any challenges or issues discussed during the meeting. Note any potential solutions or strategies proposed to address these challenges
|
||||||
|
|
||||||
|
- In a section caled NEXT STEPS, Outline the next steps and action plan to be taken after the meeting
|
||||||
|
|
||||||
|
# OUTPUT INSTRUCTIONS
|
||||||
|
|
||||||
|
- Only output Markdown.
|
||||||
|
- Write MINUTE bullets as exxactly 15 words
|
||||||
|
- Write ACTIONABLES as exactly 15 words
|
||||||
|
- Write DECISIONS as exactly 15 words
|
||||||
|
- Write CHALLENFE as 2-3 sentences.
|
||||||
|
- Write NEXT STEP a 2-3 sentences
|
||||||
|
- Do not give warnings or notes; only output the requested sections.
|
||||||
|
- Do not repeat ideas, quotes, facts, or resources.
|
||||||
|
- You use bulleted lists for output, not numbered lists.
|
||||||
|
- Do not start items with the same opening words.
|
||||||
|
- Ensure you follow ALL these instructions when creating your output.
|
||||||
|
|
||||||
|
# INPUT
|
||||||
|
|
||||||
|
INPUT:
|
22
patterns/write_latex/system.md
Normal file
22
patterns/write_latex/system.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
You are an expert at outputting syntactically correct LaTeX for a new .tex document. Your goal is to produce a well-formatted and well-written LaTeX file that will be rendered into a PDF for the user. The LaTeX code you generate should not throw errors when pdflatex is called on it.
|
||||||
|
|
||||||
|
Follow these steps to create the LaTeX document:
|
||||||
|
|
||||||
|
1. Begin with the document class and preamble. Include necessary packages based on the user's request.
|
||||||
|
|
||||||
|
2. Use the \begin{document} command to start the document body.
|
||||||
|
|
||||||
|
3. Create the content of the document based on the user's request. Use appropriate LaTeX commands and environments to structure the document (e.g., \section, \subsection, itemize, tabular, equation).
|
||||||
|
|
||||||
|
4. End the document with the \end{document} command.
|
||||||
|
|
||||||
|
Important notes:
|
||||||
|
- Do not output anything besides the valid LaTeX code. Any additional thoughts or comments should be placed within \iffalse ... \fi sections.
|
||||||
|
- Do not use fontspec as it can make it fail to run.
|
||||||
|
- For sections and subsections, append an asterisk like this \section* in order to prevent everything from being numbered unless the user asks you to number the sections.
|
||||||
|
- Ensure all LaTeX commands and environments are properly closed.
|
||||||
|
- Use appropriate indentation for better readability.
|
||||||
|
|
||||||
|
Begin your output with the LaTeX code for the requested document. Do not include any explanations or comments outside of the LaTeX code itself.
|
||||||
|
|
||||||
|
The user's request for the LaTeX document will be included here.
|
105
to_pdf/to_pdf.go
Normal file
105
to_pdf/to_pdf.go
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var input io.Reader
|
||||||
|
var outputFile string
|
||||||
|
if len(os.Args) > 1 {
|
||||||
|
// File input mode
|
||||||
|
file, err := os.Open(os.Args[1])
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error opening file: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
input = file
|
||||||
|
outputFile = strings.TrimSuffix(os.Args[1], filepath.Ext(os.Args[1])) + ".pdf"
|
||||||
|
} else {
|
||||||
|
// Stdin mode
|
||||||
|
input = os.Stdin
|
||||||
|
outputFile = "output.pdf"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if pdflatex is installed
|
||||||
|
if _, err := exec.LookPath("pdflatex"); err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr, "Error: pdflatex is not installed or not in your PATH.")
|
||||||
|
fmt.Fprintln(os.Stderr, "Please install a LaTeX distribution (e.g., TeX Live or MiKTeX) and ensure pdflatex is in your PATH.")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a temporary directory
|
||||||
|
tmpDir, err := os.MkdirTemp("", "latex_")
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error creating temporary directory: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
|
// Create a temporary .tex file
|
||||||
|
tmpFile, err := os.Create(filepath.Join(tmpDir, "input.tex"))
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error creating temporary file: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy input to the temporary file
|
||||||
|
_, err = io.Copy(tmpFile, input)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error writing to temporary file: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
tmpFile.Close()
|
||||||
|
|
||||||
|
// Run pdflatex with nonstopmode
|
||||||
|
cmd := exec.Command("pdflatex", "-interaction=nonstopmode", "-output-directory", tmpDir, tmpFile.Name())
|
||||||
|
output, err := cmd.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error running pdflatex: %v\n", err)
|
||||||
|
fmt.Fprintf(os.Stderr, "pdflatex output:\n%s\n", output)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if PDF was actually created
|
||||||
|
pdfPath := filepath.Join(tmpDir, "input.pdf")
|
||||||
|
if _, err := os.Stat(pdfPath); os.IsNotExist(err) {
|
||||||
|
fmt.Fprintln(os.Stderr, "Error: PDF file was not created. There might be an issue with your LaTeX source.")
|
||||||
|
fmt.Fprintf(os.Stderr, "pdflatex output:\n%s\n", output)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move the output PDF to the current directory
|
||||||
|
err = os.Rename(pdfPath, outputFile)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error moving output file: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean up temporary files
|
||||||
|
cleanupTempFiles(tmpDir)
|
||||||
|
|
||||||
|
fmt.Printf("PDF created: %s\n", outputFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
func cleanupTempFiles(dir string) {
|
||||||
|
extensions := []string{".aux", ".log", ".out", ".toc", ".lof", ".lot", ".bbl", ".blg"}
|
||||||
|
for _, ext := range extensions {
|
||||||
|
files, err := filepath.Glob(filepath.Join(dir, "*"+ext))
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error finding %s files: %v\n", ext, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, file := range files {
|
||||||
|
if err := os.Remove(file); err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error removing file %s: %v\n", file, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
vendors/siliconcloud/siliconcloud.go
vendored
Normal file
15
vendors/siliconcloud/siliconcloud.go
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package siliconcloud
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/danielmiessler/fabric/vendors/openai"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewClient() (ret *Client) {
|
||||||
|
ret = &Client{}
|
||||||
|
ret.Client = openai.NewClientCompatible("SiliconCloud", "https://api.siliconflow.cn/v1", nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
*openai.Client
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user