diff --git a/README.md b/README.md index 2aa90898..a93e09b4 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ Then [set your environmental variables](#environmental-variables) as shown above The great thing about Go is that it's super easy to upgrade. Just run the same command you used to install it in the first place and you'll always get the latest version. ```bash -go install -ldflags "-X main.version=$(git describe --tags --always)" github.com/danielmiessler/fabric@latest +go install github.com/danielmiessler/fabric@latest ``` ## Usage @@ -217,7 +217,7 @@ Application Options: -v, --variable= Values for pattern variables, e.g. -v=#role:expert -v=#points:30" -C, --context= Choose a context from the available contexts --session= Choose a session from the available sessions - -a, --attachment= Attachment path or URL (e.g. for OpenAI image recognition messages) + -a, --attachment= Attachment path or URL (e.g. for OpenAI image recognition messages) -S, --setup Run setup for all reconfigurable parts of fabric -t, --temperature= Set temperature (default: 0.7) -T, --topp= Set top P (default: 0.9) diff --git a/cli/cli.go b/cli/cli.go index 5dead23f..a08f4894 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -175,8 +175,7 @@ func Cli(version string) (err error) { } if !currentFlags.IsChatRequest() { - // if the pattern flag is not set, we wanted only to grab the transcript or comments - fmt.Println(messageTools) + err = currentFlags.WriteOutput(messageTools) return } } @@ -202,8 +201,7 @@ func Cli(version string) (err error) { } if !currentFlags.IsChatRequest() { - // if the pattern flag is not set, we wanted only to grab the url or get the answer to the question - fmt.Println(messageTools) + err = currentFlags.WriteOutput(messageTools) return } } diff --git a/cli/flags.go b/cli/flags.go index e833265b..dcc39d2b 100644 --- a/cli/flags.go +++ b/cli/flags.go @@ -191,6 +191,14 @@ func (o *Flags) IsChatRequest() (ret bool) { return } +func (o *Flags) WriteOutput(message string) (err error) { + fmt.Println(message) + if o.Output != "" { + err = CreateOutputFile(message, o.Output) + } + return +} + func AppendMessage(message string, newMessage string) (ret string) { if message != "" { ret = message + "\n" + newMessage diff --git a/cli/output.go b/cli/output.go index f65b6ca8..9fa91e51 100644 --- a/cli/output.go +++ b/cli/output.go @@ -22,6 +22,8 @@ func CreateOutputFile(message string, fileName string) (err error) { defer file.Close() if _, err = file.WriteString(message); err != nil { err = fmt.Errorf("error writing to file: %v", err) + } else { + fmt.Printf("\n\n... written to %s\n", fileName) } return } diff --git a/plugins/tools/youtube/youtube.go b/plugins/tools/youtube/youtube.go index 858101ec..dd8d0eb2 100644 --- a/plugins/tools/youtube/youtube.go +++ b/plugins/tools/youtube/youtube.go @@ -85,7 +85,7 @@ func (o *YouTube) GrabTranscript(videoId string, language string) (ret string, e textTags := doc.FindAll("text") var textBuilder strings.Builder for _, textTag := range textTags { - textBuilder.WriteString(textTag.Text()) + textBuilder.WriteString(strings.ReplaceAll(textTag.Text(), "'", "'")) textBuilder.WriteString(" ") ret = textBuilder.String() }