Skip to content

Commit

Permalink
config: change chunkdelay default, organize
Browse files Browse the repository at this point in the history
  • Loading branch information
alexschlessinger committed Apr 15, 2023
1 parent 4d5badd commit 639eb16
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,41 @@ import (
func init() {

cobra.OnInitialize(initConfig)

// irc client configuration
root.PersistentFlags().StringP("nick", "n", "soulshack", "bot's nickname on the irc server")
root.PersistentFlags().StringP("server", "s", "localhost", "irc server address")
root.PersistentFlags().BoolP("ssl", "e", false, "enable SSL for the IRC connection")
root.PersistentFlags().Int("maxtokens", 512, "maximum number of tokens to generate")
root.PersistentFlags().IntP("port", "p", 6667, "irc server port")
root.PersistentFlags().String("goodbye", "goodbye.", "prompt to be used when the bot leaves the channel")
root.PersistentFlags().String("greeting", "hello.", "prompt to be used when the bot joins the channel")
root.PersistentFlags().String("model", ai.GPT4, "model to be used for responses (e.g., gpt-4")
root.PersistentFlags().String("openaikey", "", "openai api key")
root.PersistentFlags().String("prompt", "respond in a short text:", "initial system prompt for the ai")
root.PersistentFlags().StringP("become", "b", "chatbot", "become the named personality")
root.PersistentFlags().StringP("channel", "c", "", "irc channel to join")
root.PersistentFlags().StringP("nick", "n", "soulshack", "bot's nickname on the irc server")
root.PersistentFlags().StringP("server", "s", "localhost", "irc server address")

// bot configuration
root.PersistentFlags().StringP("become", "b", "chatbot", "become the named personality")
root.PersistentFlags().StringP("directory", "d", "./personalities", "personalities configuration directory")
root.PersistentFlags().StringSliceP("admins", "A", []string{}, "comma-separated list of allowed users to administrate the bot (e.g., user1,user2,user3)")
root.PersistentFlags().DurationP("session", "S", time.Minute*3, "duration for the chat session; message context will be cleared after this time")
root.PersistentFlags().IntP("history", "H", 15, "maximum number of lines of context to keep per session")
root.PersistentFlags().DurationP("timeout", "t", time.Second*60, "timeout for each completion request to openai")

// informational
root.PersistentFlags().BoolP("list", "l", false, "list configured personalities")
root.PersistentFlags().StringP("directory", "d", "./personalities", "personalities configuration directory")
root.PersistentFlags().BoolP("verbose", "v", false, "enable verbose logging of sessions and configuration")

// openai configuration
root.PersistentFlags().String("openaikey", "", "openai api key")
root.PersistentFlags().Int("maxtokens", 512, "maximum number of tokens to generate")
root.PersistentFlags().String("model", ai.GPT4, "model to be used for responses (e.g., gpt-4)")

// timeouts and behavior
root.PersistentFlags().BoolP("addressed", "a", true, "require bot be addressed by nick for response")
root.PersistentFlags().DurationP("chunkdelay", "C", time.Second*5, "after this delay, bot will look to split the incoming buffer on sentence boundaries")
root.PersistentFlags().DurationP("session", "S", time.Minute*3, "duration for the chat session; message context will be cleared after this time")
root.PersistentFlags().DurationP("timeout", "t", time.Second*60, "timeout for each completion request to openai")
root.PersistentFlags().IntP("history", "H", 15, "maximum number of lines of context to keep per session")
root.PersistentFlags().DurationP("chunkdelay", "C", time.Second*15, "after this delay, bot will look to split the incoming buffer on sentence boundaries")
root.PersistentFlags().IntP("chunkmax", "m", 350, "maximum number of characters to send as a single message")

// personality / prompting
root.PersistentFlags().String("goodbye", "goodbye.", "prompt to be used when the bot leaves the channel")
root.PersistentFlags().String("greeting", "hello.", "prompt to be used when the bot joins the channel")
root.PersistentFlags().String("prompt", "respond in a short text:", "initial system prompt for the ai")

vip.BindPFlags(root.PersistentFlags())

vip.SetEnvPrefix("SOULSHACK")
Expand Down

0 comments on commit 639eb16

Please sign in to comment.