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)
|
# Comma seperated list of twitch channels the bot should join (no spaces)
|
||||||
TWITCH_CHANNELS=channelone,channeltwo,channelthree
|
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
|
olm.Content = input
|
||||||
app.UserMsgStore[username] = append(app.UserMsgStore[username], olm)
|
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.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.Messages = app.UserMsgStore[username]
|
||||||
requestBody.Prompt = input
|
requestBody.Prompt = input
|
||||||
|
@ -89,7 +89,7 @@ func (app *application) chatGeneralContext(target, input string) {
|
||||||
olm.Content = input
|
olm.Content = input
|
||||||
app.MsgStore = append(app.MsgStore, olm)
|
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.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.Messages = app.MsgStore
|
||||||
requestBody.Prompt = input
|
requestBody.Prompt = input
|
||||||
|
@ -131,7 +131,7 @@ func (app *application) chatGeneralContext(target, input string) {
|
||||||
func (app *application) generateNoContext(target, input string) {
|
func (app *application) generateNoContext(target, input string) {
|
||||||
var requestBody ollamaRequest
|
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.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.Prompt = input
|
||||||
requestBody.Stream = false
|
requestBody.Stream = false
|
||||||
|
|
3
main.go
3
main.go
|
@ -18,7 +18,7 @@ type config struct {
|
||||||
type application struct {
|
type application struct {
|
||||||
TwitchClient *twitch.Client
|
TwitchClient *twitch.Client
|
||||||
Log *zap.SugaredLogger
|
Log *zap.SugaredLogger
|
||||||
Environment string
|
OllamaModel string
|
||||||
Config config
|
Config config
|
||||||
UserMsgStore map[string][]ollamaMessage
|
UserMsgStore map[string][]ollamaMessage
|
||||||
MsgStore []ollamaMessage
|
MsgStore []ollamaMessage
|
||||||
|
@ -52,6 +52,7 @@ func main() {
|
||||||
app := &application{
|
app := &application{
|
||||||
TwitchClient: tc,
|
TwitchClient: tc,
|
||||||
Log: sugar,
|
Log: sugar,
|
||||||
|
OllamaModel: os.Getenv("OLLAMA_MODEL"),
|
||||||
Config: cfg,
|
Config: cfg,
|
||||||
UserMsgStore: userMsgStore,
|
UserMsgStore: userMsgStore,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue