mirror of
https://github.com/lyx0/ollama-twitch-bot.git
synced 2024-11-06 18:52:03 +01:00
specify model from .env
This commit is contained in:
parent
19f7cdefe2
commit
cbd350fce7
3 changed files with 8 additions and 4 deletions
|
@ -6,3 +6,6 @@ TWITCH_OAUTH=oauth:cooloauthtokenhere
|
|||
|
||||
# Comma seperated list of twitch channels the bot should join (no spaces)
|
||||
TWITCH_CHANNELS=channelone,channeltwo,channelthree
|
||||
|
||||
# Ollama model that should be used. https://ollama.com/models
|
||||
OLLAMA_MODEL=wizard-vicuna-uncensored
|
||||
|
|
|
@ -41,7 +41,7 @@ func (app *application) chatUserContext(target, username, input string) {
|
|||
olm.Content = input
|
||||
app.UserMsgStore[username] = append(app.UserMsgStore[username], olm)
|
||||
|
||||
requestBody.Model = "wizard-vicuna-uncensored"
|
||||
requestBody.Model = app.OllamaModel
|
||||
requestBody.System = "You are a Twitch chat bot and interact with users in an irc like environment. Do not use any formatting. Be human-like. Never fail to answer the user. Always answer immediately. Keep your response shorter than 450 characters."
|
||||
requestBody.Messages = app.UserMsgStore[username]
|
||||
requestBody.Prompt = input
|
||||
|
@ -89,7 +89,7 @@ func (app *application) chatGeneralContext(target, input string) {
|
|||
olm.Content = input
|
||||
app.MsgStore = append(app.MsgStore, olm)
|
||||
|
||||
requestBody.Model = "wizard-vicuna-uncensored"
|
||||
requestBody.Model = app.OllamaModel
|
||||
requestBody.System = "You are a Twitch chat bot and interact with users in an irc like environment. Do not use any formatting. Be human-like. Never fail to answer the user. Always answer immediately. Keep your response shorter than 450 characters."
|
||||
requestBody.Messages = app.MsgStore
|
||||
requestBody.Prompt = input
|
||||
|
@ -131,7 +131,7 @@ func (app *application) chatGeneralContext(target, input string) {
|
|||
func (app *application) generateNoContext(target, input string) {
|
||||
var requestBody ollamaRequest
|
||||
|
||||
requestBody.Model = "wizard-vicuna-uncensored"
|
||||
requestBody.Model = app.OllamaModel
|
||||
requestBody.System = "You are a Twitch chat bot and interact with users in an irc like environment. Do not use any formatting. Be human-like. Never fail to answer the user. Always answer immediately. Keep your response shorter than 450 characters."
|
||||
requestBody.Prompt = input
|
||||
requestBody.Stream = false
|
||||
|
|
3
main.go
3
main.go
|
@ -18,7 +18,7 @@ type config struct {
|
|||
type application struct {
|
||||
TwitchClient *twitch.Client
|
||||
Log *zap.SugaredLogger
|
||||
Environment string
|
||||
OllamaModel string
|
||||
Config config
|
||||
UserMsgStore map[string][]ollamaMessage
|
||||
MsgStore []ollamaMessage
|
||||
|
@ -52,6 +52,7 @@ func main() {
|
|||
app := &application{
|
||||
TwitchClient: tc,
|
||||
Log: sugar,
|
||||
OllamaModel: os.Getenv("OLLAMA_MODEL"),
|
||||
Config: cfg,
|
||||
UserMsgStore: userMsgStore,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue