optimize session memory and language routing for migration

This commit is contained in:
DBT
2026-02-23 09:49:49 +00:00
parent a3097c4c30
commit e038c00ebc
6 changed files with 658 additions and 5812 deletions

View File

@@ -163,7 +163,7 @@ func (cb *ContextBuilder) LoadBootstrapFiles() string {
return result
}
func (cb *ContextBuilder) BuildMessages(history []providers.Message, summary string, currentMessage string, media []string, channel, chatID string) []providers.Message {
func (cb *ContextBuilder) BuildMessages(history []providers.Message, summary string, currentMessage string, media []string, channel, chatID, responseLanguage string) []providers.Message {
messages := []providers.Message{}
systemPrompt := cb.BuildSystemPrompt()
@@ -173,6 +173,9 @@ func (cb *ContextBuilder) BuildMessages(history []providers.Message, summary str
if channel != "" && chatID != "" {
systemPrompt += fmt.Sprintf("\n\n## Current Session\nChannel: %s\nChat ID: %s", channel, chatID)
}
if responseLanguage != "" {
systemPrompt += fmt.Sprintf("\n\n## Response Language\nReply in %s unless user explicitly asks to switch language. Keep code identifiers and CLI commands unchanged.", responseLanguage)
}
// Log system prompt summary for debugging (debug mode only)
logger.DebugCF("agent", "System prompt built",