mirror of
https://github.com/prosolis/gogobee.git
synced 2026-09-14 10:51:09 +00:00
llm: route every LLM caller through a shared backend client
Replaces the per-plugin Ollama HTTP calls with internal/llm, which picks a backend from the environment (vLLM or Ollama) behind one Chat interface, plus internal/plugin/llm_client.go as the plugin-facing wrapper. Startup now logs llm_backend/llm_endpoint/llm_model instead of the two OLLAMA_* vars, which no longer describe where inference actually goes. These files were already running in prod from the vLLM migration but had never been committed; this is that live state, byte-for-byte.
This commit is contained in:
@@ -120,9 +120,7 @@ func (p *VibePlugin) resetCooldown(roomID id.RoomID) {
|
||||
}
|
||||
|
||||
func (p *VibePlugin) handleVibe(ctx MessageContext) error {
|
||||
ollamaHost := os.Getenv("OLLAMA_HOST")
|
||||
ollamaModel := os.Getenv("OLLAMA_MODEL")
|
||||
if ollamaHost == "" || ollamaModel == "" {
|
||||
if !llmConfigured() {
|
||||
return p.SendReply(ctx.RoomID, ctx.EventID, "LLM is not configured.")
|
||||
}
|
||||
|
||||
@@ -154,7 +152,7 @@ Describe the room's current vibe:`, botName, transcript)
|
||||
slog.Error("vibe: send thinking", "err", err)
|
||||
}
|
||||
|
||||
response, err := callOllama(ollamaHost, ollamaModel, prompt)
|
||||
response, err := callLLM(prompt)
|
||||
if err != nil {
|
||||
slog.Error("vibe: ollama call", "err", err)
|
||||
p.resetCooldown(ctx.RoomID) // Don't consume cooldown on failure
|
||||
@@ -165,9 +163,7 @@ Describe the room's current vibe:`, botName, transcript)
|
||||
}
|
||||
|
||||
func (p *VibePlugin) handleTLDR(ctx MessageContext) error {
|
||||
ollamaHost := os.Getenv("OLLAMA_HOST")
|
||||
ollamaModel := os.Getenv("OLLAMA_MODEL")
|
||||
if ollamaHost == "" || ollamaModel == "" {
|
||||
if !llmConfigured() {
|
||||
return p.SendReply(ctx.RoomID, ctx.EventID, "LLM is not configured.")
|
||||
}
|
||||
|
||||
@@ -199,7 +195,7 @@ Summary:`, tldrBotName, transcript)
|
||||
slog.Error("vibe: send thinking", "err", err)
|
||||
}
|
||||
|
||||
response, err := callOllama(ollamaHost, ollamaModel, prompt)
|
||||
response, err := callLLM(prompt)
|
||||
if err != nil {
|
||||
slog.Error("vibe: ollama call", "err", err)
|
||||
p.resetCooldown(ctx.RoomID) // Don't consume cooldown on failure
|
||||
|
||||
Reference in New Issue
Block a user