Merge pull request #967 from trheyi/main

Enhance Context struct by adding Locale and Theme fields
This commit is contained in:
Max 2025-05-19 18:16:22 +08:00 committed by GitHub
commit d8e7560ff7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,15 +22,21 @@ type Context struct {
Namespace string `json:"namespace,omitempty"`
Config map[string]interface{} `json:"config,omitempty"`
Signal interface{} `json:"signal,omitempty"`
Locale string `json:"locale,omitempty"` // Locale
Theme string `json:"theme,omitempty"` // Theme
Silent bool `json:"silent,omitempty"` // Silent mode
ClientType string `json:"client_type,omitempty"` // The request client type. SDK, Desktop, Web, JSSDK, etc. the default is Web
HistoryVisible bool `json:"history_visible,omitempty"` // History visible, default is true, if false, the history will not be displayed in the UI
Retry bool `json:"retry,omitempty"` // Retry mode
RetryTimes uint8 `json:"retry_times,omitempty"` // Retry times
Upload *FileUpload `json:"upload,omitempty"`
Upload *FileUpload `json:"upload,omitempty"` // Will be removed in the future
Vision bool `json:"vision,omitempty"` // Vision support
Search bool `json:"search,omitempty"` // Search support
RAG bool `json:"rag,omitempty"` // RAG support
Args []interface{} `json:"args,omitempty"` // Arguments for call
SharedSpace plan.Space `json:"-"` // Shared space
}
@ -244,5 +250,11 @@ func (ctx *Context) Map() map[string]interface{} {
data["upload"] = ctx.Upload
}
// Locale
data["locale"] = ctx.Locale
// Theme
data["theme"] = ctx.Theme
return data
}