Skip to content

Commit

Permalink
system messages
Browse files Browse the repository at this point in the history
  • Loading branch information
seemywingz committed Apr 26, 2024
1 parent d5e3f9f commit dbbb547
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 45 deletions.
15 changes: 1 addition & 14 deletions cmd/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import (

var convo bool
var sayText bool
var ponderMessages = []goai.Message{{
Role: "system",
Content: ponder_SystemMessage,
}}
var ponderMessages = []goai.Message{}

func init() {
rootCmd.AddCommand(chatCmd)
Expand Down Expand Up @@ -62,16 +59,6 @@ func chatCompletion(prompt string) string {
return res.Choices[0].Message.Content
}

// func cliCommand(command string, args ...string) {
// cli := exec.Command(command, args...)
// output, err := cli.Output()
// if err != nil {
// fmt.Println(err)
// } else {
// fmt.Println(string(output))
// }
// }

func getUserInput() (string, error) {
// ReadString will block until the delimiter is entered
reader := bufio.NewReader(os.Stdin)
Expand Down
16 changes: 0 additions & 16 deletions cmd/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,3 @@ package cmd

const APP_VERSION = "v0.3.0"
const printify_endpoint = "https://api.printify.com/v1/"

const ponder_SystemMessage = `You are Ponder.Welcome to Ponder!
I'm an advanced chat bot powered by OpenAI,
designed to assist you with your needs and provide helpful responses.
Whether you have questions about a particular topic or need assistance with a task,
I'm here to help. Please feel free to ask me anything, and I'll do my best to provide
you with accurate and informative answers. Thank you for choosing Ponder!`

const command_SystemMessage = `You are A new cli tool,
This tool is designed to generate executable command-line interface (CLI) commands,
including options and parameters, based on user input. you should respond simply with the command and its arguments, nothing else.
When prompted, you are to provide accurate and executable CLI commands tailored to the user's specific requirements.
Please ensure that the commands are syntactically correct and applicable to common command-line environments.
Exercise caution and prioritize user safety and system security in all command outputs.
Please provide only the executable CLI command with its necessary arguments, without any additional explanations or prefixes.
you should respond simply with the command and its arguments, nothing else.`
10 changes: 8 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ func viperConfig() {
viper.SetDefault("openAI_image_size", "1024x1024")
viper.SetDefault("openAI_image_downloadPath", "~/Ponder/Images/")

viper.SetDefault("openAI_chat_model", "gpt-4")

viper.SetDefault("openAI_tts_model", "tts-1")
viper.SetDefault("openAI_tts_voice", "onyx")
viper.SetDefault("openAI_tts_speed", "1")
Expand All @@ -102,6 +100,9 @@ func viperConfig() {
viper.SetDefault("openAI_speed", "1")
viper.SetDefault("openAI_responseFormat", "mp3")

viper.SetDefault("openAI_chat_model", "gpt-4")
viper.SetDefault("openAI_chat_systemMessage", "You are a helpful assistant.")

viper.SetDefault("openAI_topP", "0.9")
viper.SetDefault("openAI_frequencyPenalty", "0.0")
viper.SetDefault("openAI_presencePenalty", "0.6")
Expand Down Expand Up @@ -133,6 +134,11 @@ func viperConfig() {
}
}

ponderMessages = []goai.Message{{
Role: "system",
Content: viper.GetString("openAI_chat_systemMessage"),
}}

ai = &goai.Client{
Endpoint: viper.GetString("openAI_endpoint"),
API_KEY: OPENAI_API_KEY,
Expand Down
2 changes: 1 addition & 1 deletion cmd/tts.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
Copyright © 2024 Kevin Jayne <[email protected]>
*/
package cmd

Expand Down
7 changes: 7 additions & 0 deletions files/config
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ openAI_maxTokens: 999
openAI_presencePenalty: 0.6
openAI_frequencyPenalty: 0.0

openAI_chat_systemMessage: |
You are Ponder.Welcome to Ponder!
I'm an advanced chat bot powered by OpenAI,
designed to assist you with your needs and provide helpful responses.
Whether you have questions about a particular topic or need assistance with a task,
I'm here to help. Please feel free to ask me anything, and I'll do my best to provide
you with accurate and informative answers. Thank you for choosing Ponder!

discord_message_context_count: 15
discord_bot_systemMessage: |
Expand Down
31 changes: 19 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ require (
github.com/bwmarrin/discordgo v0.27.1
github.com/seemywingz/goai v0.0.0-20231126180305-d3f04a0b4746
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.15.0
github.com/spf13/viper v1.18.2
)

require (
github.com/faiface/beep v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hajimehoshi/go-mp3 v0.3.0 // indirect
github.com/hajimehoshi/oto v1.0.1 // indirect
Expand All @@ -22,19 +22,26 @@ require (
github.com/jonboulle/clockwork v0.3.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 // indirect
golang.org/x/image v0.1.0 // indirect
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tosone/minimp3 v1.0.2 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/exp/shiny v0.0.0-20240416160154-fe59bbe5cc7f // indirect
golang.org/x/image v0.15.0 // indirect
golang.org/x/mobile v0.0.0-20240404231514-09dbf07665ed // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
periph.io/x/bootstrap v1.1.0 // indirect
Expand Down
Loading

0 comments on commit dbbb547

Please sign in to comment.