feat: Introduce conversation configuration management and localization updates
- Added new ConversationConfig interface and API endpoints for retrieving and updating conversation settings. - Enhanced AgentSettings.vue to include UI for configuring conversation parameters such as prompt, context template, temperature, and max tokens. - Updated localization files in English and Chinese to include new strings for conversation settings. - Implemented logic to load and save conversation configuration for tenants, ensuring defaults are applied when no specific configuration exists.
This commit is contained in:
@@ -34,6 +34,8 @@ type Tenant struct {
|
||||
ContextConfig *ContextConfig `yaml:"context_config" json:"context_config" gorm:"type:jsonb"`
|
||||
// Global WebSearch configuration for this tenant
|
||||
WebSearchConfig *WebSearchConfig `yaml:"web_search_config" json:"web_search_config" gorm:"type:jsonb"`
|
||||
// Global Conversation configuration for this tenant (default for normal mode sessions)
|
||||
ConversationConfig *ConversationConfig `yaml:"conversation_config" json:"conversation_config" gorm:"type:jsonb"`
|
||||
// Creation time
|
||||
CreatedAt time.Time `yaml:"created_at" json:"created_at"`
|
||||
// Last updated time
|
||||
@@ -69,3 +71,35 @@ func (c *RetrieverEngines) Scan(value interface{}) error {
|
||||
}
|
||||
return json.Unmarshal(b, c)
|
||||
}
|
||||
|
||||
// ConversationConfig represents the conversation configuration for normal mode
|
||||
type ConversationConfig struct {
|
||||
// Prompt is the system prompt
|
||||
Prompt string `json:"prompt"`
|
||||
// ContextTemplate is the prompt template for summarizing retrieval results
|
||||
ContextTemplate string `json:"context_template"`
|
||||
// Temperature controls the randomness of the model output
|
||||
Temperature float64 `json:"temperature"`
|
||||
// MaxTokens is the maximum number of tokens to generate
|
||||
MaxTokens int `json:"max_tokens"`
|
||||
}
|
||||
|
||||
// Value implements the driver.Valuer interface, used to convert ConversationConfig to database value
|
||||
func (c *ConversationConfig) Value() (driver.Value, error) {
|
||||
if c == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return json.Marshal(c)
|
||||
}
|
||||
|
||||
// Scan implements the sql.Scanner interface, used to convert database value to ConversationConfig
|
||||
func (c *ConversationConfig) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
b, ok := value.([]byte)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return json.Unmarshal(b, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user