mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-09 22:38:10 -05:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f0cc85742 | ||
|
|
7275dfbd6b | ||
|
|
9f94cfb718 | ||
|
|
e1fa674a3f | ||
|
|
34f804be3a | ||
|
|
83cd8a1912 | ||
|
|
d347ef0dcc | ||
|
|
44cc9bbcac | ||
|
|
4aa0b99c74 | ||
|
|
d90e8081ac | ||
|
|
70d43c5252 | ||
|
|
fd8216f1bd | ||
|
|
ae0c9009d9 | ||
|
|
bad01040e3 | ||
|
|
0b26b930f9 | ||
|
|
5dbaf4f28f | ||
|
|
1d9cce5adf | ||
|
|
76622105e2 | ||
|
|
e6e3e34f53 | ||
|
|
7192ddbaa6 | ||
|
|
b5206d1923 | ||
|
|
81d60b4292 |
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -94,11 +94,19 @@ jobs:
|
||||
path: fabric-windows-${{ matrix.arch }}.exe
|
||||
|
||||
- name: Get latest tag
|
||||
if: matrix.os != 'windows-latest'
|
||||
id: get_latest_tag
|
||||
run: |
|
||||
latest_tag=$(git tag --sort=-creatordate | head -n 1)
|
||||
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
|
||||
|
||||
- name: Get latest tag
|
||||
if: matrix.os == 'windows-latest'
|
||||
id: get_latest_tag_windows
|
||||
run: |
|
||||
$latest_tag = git tag --sort=-creatordate | Select-Object -First 1
|
||||
Add-Content -Path $env:GITHUB_ENV -Value "latest_tag=$latest_tag"
|
||||
|
||||
- name: Create release if it doesn't exist
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -293,7 +293,7 @@ pbpaste | fabric --stream --pattern analyze_claims
|
||||
3. Run the `extract_wisdom` Pattern with the `--stream` option to get immediate and streaming results from any Youtube video (much like in the original introduction video).
|
||||
|
||||
```bash
|
||||
fabric -y "https://youtube.com/watch?v=uXs-zPc63kM" | --stream --pattern extract_wisdom
|
||||
fabric -y "https://youtube.com/watch?v=uXs-zPc63kM" --stream --pattern extract_wisdom
|
||||
```
|
||||
|
||||
4. Create patterns- you must create a .md file with the pattern and save it to ~/.config/fabric/patterns/[yourpatternname].
|
||||
|
||||
14
cli/cli.go
14
cli/cli.go
@@ -146,8 +146,12 @@ func Cli(version string) (err error) {
|
||||
if !currentFlags.YouTubeComments || currentFlags.YouTubeTranscript {
|
||||
var transcript string
|
||||
var language = "en"
|
||||
if currentFlags.Language != "" {
|
||||
language = currentFlags.Language
|
||||
if currentFlags.Language != "" || fabric.DefaultLanguage.Value != "" {
|
||||
if currentFlags.Language != "" {
|
||||
language = currentFlags.Language
|
||||
} else {
|
||||
language = fabric.DefaultLanguage.Value
|
||||
}
|
||||
}
|
||||
if transcript, err = fabric.YouTube.GrabTranscript(videoId, language); err != nil {
|
||||
return
|
||||
@@ -208,7 +212,11 @@ func Cli(version string) (err error) {
|
||||
}
|
||||
|
||||
var session *db.Session
|
||||
if session, err = chatter.Send(currentFlags.BuildChatRequest(strings.Join(os.Args[1:], " ")), currentFlags.BuildChatOptions()); err != nil {
|
||||
chatReq := currentFlags.BuildChatRequest(strings.Join(os.Args[1:], " "))
|
||||
if chatReq.Language == "" {
|
||||
chatReq.Language = fabric.DefaultLanguage.Value
|
||||
}
|
||||
if session, err = chatter.Send(chatReq, currentFlags.BuildChatOptions()); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,8 @@ func TestBuildChatRequest(t *testing.T) {
|
||||
SessionName: "test-session",
|
||||
PatternName: "test-pattern",
|
||||
Message: "test-message",
|
||||
Meta: "test",
|
||||
}
|
||||
request := flags.BuildChatRequest()
|
||||
request := flags.BuildChatRequest("test")
|
||||
assert.Equal(t, expectedRequest, request)
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ func (o *Chatter) Send(request *common.ChatRequest, opts *common.ChatOptions) (s
|
||||
if o.Stream {
|
||||
channel := make(chan string)
|
||||
go func() {
|
||||
if streamErr := o.vendor.SendStream(session.Messages, opts, channel); streamErr != nil {
|
||||
if streamErr := o.vendor.SendStream(session.GetVendorMessages(), opts, channel); streamErr != nil {
|
||||
channel <- streamErr.Error()
|
||||
}
|
||||
}()
|
||||
@@ -52,6 +52,7 @@ func (o *Chatter) Send(request *common.ChatRequest, opts *common.ChatOptions) (s
|
||||
if message == "" {
|
||||
session = nil
|
||||
err = fmt.Errorf("empty response")
|
||||
return
|
||||
}
|
||||
|
||||
session.Append(&common.Message{Role: goopenai.ChatMessageRoleAssistant, Content: message})
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuildChatSession(t *testing.T) {
|
||||
chat := &Chat{
|
||||
Context: "test context",
|
||||
Pattern: "test pattern",
|
||||
Message: "test message",
|
||||
}
|
||||
session, err := chat.BuildChatSession(false)
|
||||
if err != nil {
|
||||
t.Fatalf("BuildChatSession() error = %v", err)
|
||||
}
|
||||
|
||||
if session == nil {
|
||||
t.Fatalf("BuildChatSession() returned nil session")
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,14 @@ package core
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/atotto/clipboard"
|
||||
"github.com/danielmiessler/fabric/common"
|
||||
"github.com/danielmiessler/fabric/db"
|
||||
"github.com/danielmiessler/fabric/jina"
|
||||
"github.com/danielmiessler/fabric/lang"
|
||||
"github.com/danielmiessler/fabric/vendors/anthropic"
|
||||
"github.com/danielmiessler/fabric/vendors/azure"
|
||||
"github.com/danielmiessler/fabric/vendors/dryrun"
|
||||
@@ -19,8 +23,6 @@ import (
|
||||
"github.com/danielmiessler/fabric/vendors/siliconcloud"
|
||||
"github.com/danielmiessler/fabric/youtube"
|
||||
"github.com/pkg/errors"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const DefaultPatternsGitRepoUrl = "https://github.com/danielmiessler/fabric.git"
|
||||
@@ -49,6 +51,7 @@ func NewFabricBase(db *db.Db) (ret *Fabric) {
|
||||
VendorsAll: NewVendorsManager(),
|
||||
PatternsLoader: NewPatternsLoader(db.Patterns),
|
||||
YouTube: youtube.NewYouTube(),
|
||||
Language: lang.NewLanguage(),
|
||||
Jina: jina.NewClient(),
|
||||
}
|
||||
|
||||
@@ -75,6 +78,7 @@ type Fabric struct {
|
||||
VendorsAll *VendorsManager
|
||||
*PatternsLoader
|
||||
*youtube.YouTube
|
||||
*lang.Language
|
||||
Jina *jina.Client
|
||||
|
||||
Db *db.Db
|
||||
@@ -101,6 +105,7 @@ func (o *Fabric) SaveEnvFile() (err error) {
|
||||
|
||||
o.YouTube.SetupFillEnvFileContent(&envFileContent)
|
||||
o.Jina.SetupFillEnvFileContent(&envFileContent)
|
||||
o.Language.SetupFillEnvFileContent(&envFileContent)
|
||||
|
||||
err = o.Db.SaveEnv(envFileContent.String())
|
||||
return
|
||||
@@ -125,6 +130,10 @@ func (o *Fabric) Setup() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
if err = o.Language.SetupOrSkip(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = o.SaveEnvFile()
|
||||
|
||||
return
|
||||
@@ -200,6 +209,7 @@ func (o *Fabric) configure() (err error) {
|
||||
//YouTube and Jina are not mandatory, so ignore not configured error
|
||||
_ = o.YouTube.Configure()
|
||||
_ = o.Jina.Configure()
|
||||
_ = o.Language.Configure()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
41
lang/language.go
Normal file
41
lang/language.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package lang
|
||||
|
||||
import (
|
||||
"github.com/danielmiessler/fabric/common"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
func NewLanguage() (ret *Language) {
|
||||
|
||||
label := "Language"
|
||||
ret = &Language{}
|
||||
|
||||
ret.Configurable = &common.Configurable{
|
||||
Label: label,
|
||||
EnvNamePrefix: common.BuildEnvVariablePrefix(label),
|
||||
ConfigureCustom: ret.configure,
|
||||
}
|
||||
|
||||
ret.DefaultLanguage = ret.Configurable.AddSetupQuestionCustom("Output", false,
|
||||
"Enter your default want output lang (for example: zh_CN)")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
type Language struct {
|
||||
*common.Configurable
|
||||
DefaultLanguage *common.SetupQuestion
|
||||
}
|
||||
|
||||
func (o *Language) configure() error {
|
||||
if o.DefaultLanguage.Value != "" {
|
||||
langTag, err := language.Parse(o.DefaultLanguage.Value)
|
||||
if err == nil {
|
||||
o.DefaultLanguage.Value = langTag.String()
|
||||
} else {
|
||||
o.DefaultLanguage.Value = ""
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
39
patterns/extract_core_message/system.md
Normal file
39
patterns/extract_core_message/system.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# IDENTITY
|
||||
|
||||
You are an expert at looking at a presentation, an essay, or a full body of lifetime work, and clearly and accurately articulating what the core message is.
|
||||
|
||||
# GOAL
|
||||
|
||||
- Produce a clear sentence that perfectly articulates the core message as presented in a given text or body of work.
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
If the input is all of Victor Frankl's work, then the core message would be:
|
||||
|
||||
Finding meaning in suffering is key to human resilience, purpose, and enduring life’s challenges.
|
||||
|
||||
END EXAMPLE
|
||||
|
||||
# STEPS
|
||||
|
||||
- Fully digest the input.
|
||||
|
||||
- Determine if the input is a single text or a body of work.
|
||||
|
||||
- Based on which it is, parse the thing that's supposed to be parsed.
|
||||
|
||||
- Extract the core message from the parsed text into a single sentence.
|
||||
|
||||
# OUTPUT
|
||||
|
||||
- Output a single, 15-word sentence that perfectly articulates the core message as presented in the input.
|
||||
|
||||
# OUTPUT INSTRUCTIONS
|
||||
|
||||
- The sentence should be a single sentence that is 15 words or fewer, with no special formatting or anything else.
|
||||
|
||||
- Do not include any setup to the sentence, e.g., "The core message is to…", etc. Just list the core message and nothing else.
|
||||
|
||||
- ONLY OUTPUT THE CORE MESSAGE, not a setup to it, commentary on it, or anything else.
|
||||
|
||||
- Do not ask questions or complain in any way about the task.
|
||||
@@ -8,15 +8,15 @@ Take a step back and think step-by-step about how to achieve the best possible r
|
||||
|
||||
- Fully digest the content provided.
|
||||
|
||||
- Extract all actionables agreed within the meeting.
|
||||
- Extract all actionables agreed upon 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 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, write 20 to 50 bullet points, highliting of the most surprising, insightful, and/or interesting ideas that come up in the conversation. If there are less than 50 then collect all of them. Make sure you extract at least 20.
|
||||
- In a section called MINUTES, write 20 to 50 bullet points, highlighting of the most surprising, insightful, and/or interesting ideas that come up in the conversation. 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 cases where a speaker agrees to do or look into something. If there is a deadline mentioned, include it here.
|
||||
|
||||
@@ -24,16 +24,16 @@ Take a step back and think step-by-step about how to achieve the best possible r
|
||||
|
||||
- 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 actions to be taken after the meeting
|
||||
- In a section called NEXT STEPS, outline the next steps and actions to be taken after the meeting.
|
||||
|
||||
# OUTPUT INSTRUCTIONS
|
||||
|
||||
- Only output Markdown.
|
||||
- Write MINUTES as exxactly 15 words.
|
||||
- Write MINUTES as exactly 15 words.
|
||||
- Write ACTIONABLES as exactly 15 words.
|
||||
- Write DECISIONS as exactly 15 words.
|
||||
- Write CHALLENGES as 2-3 sentences.
|
||||
- Write NEXT STEPS a 2-3 sentences.
|
||||
- Write NEXT STEPS as 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.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package main
|
||||
|
||||
var version = "v1.4.47"
|
||||
var version = "v1.4.56"
|
||||
|
||||
Reference in New Issue
Block a user