feat: Enhance agent configuration and localization for web search prompts
- Updated agent configuration to support separate system prompts for web search enabled and disabled states. - Removed deprecated agent configuration parameters to streamline settings management. - Enhanced UI components in AgentSettings.vue to allow configuration of custom prompts based on web search status. - Improved localization in English, Russian, and Chinese for new prompt settings and UI elements. - Refactored related API and service logic to accommodate changes in agent configuration structure.
This commit is contained in:
@@ -204,8 +204,8 @@ func (h *Handler) createDefaultSummaryConfig(ctx context.Context) *types.Summary
|
||||
if tenant.ConversationConfig.Temperature > 0 {
|
||||
cfg.Temperature = tenant.ConversationConfig.Temperature
|
||||
}
|
||||
if tenant.ConversationConfig.MaxTokens > 0 {
|
||||
cfg.MaxTokens = tenant.ConversationConfig.MaxTokens
|
||||
if tenant.ConversationConfig.MaxCompletionTokens > 0 {
|
||||
cfg.MaxCompletionTokens = tenant.ConversationConfig.MaxCompletionTokens
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ func (h *Handler) fillSummaryConfigDefaults(ctx context.Context, config *types.S
|
||||
// Determine default values: tenant config first, then config.yaml
|
||||
var defaultPrompt, defaultContextTemplate, defaultNoMatchPrefix string
|
||||
var defaultTemperature float64
|
||||
var defaultMaxTokens int
|
||||
var defaultMaxCompletionTokens int
|
||||
|
||||
if tenant != nil && tenant.ConversationConfig != nil {
|
||||
useSystemPrompt := tenant.ConversationConfig.UseCustomSystemPrompt
|
||||
@@ -234,7 +234,7 @@ func (h *Handler) fillSummaryConfigDefaults(ctx context.Context, config *types.S
|
||||
defaultContextTemplate = tenant.ConversationConfig.ContextTemplate
|
||||
}
|
||||
defaultTemperature = tenant.ConversationConfig.Temperature
|
||||
defaultMaxTokens = tenant.ConversationConfig.MaxTokens
|
||||
defaultMaxCompletionTokens = tenant.ConversationConfig.MaxCompletionTokens
|
||||
}
|
||||
|
||||
// Fall back to config.yaml if tenant config is empty
|
||||
@@ -247,8 +247,8 @@ func (h *Handler) fillSummaryConfigDefaults(ctx context.Context, config *types.S
|
||||
if defaultTemperature == 0 {
|
||||
defaultTemperature = h.config.Conversation.Summary.Temperature
|
||||
}
|
||||
if defaultMaxTokens == 0 {
|
||||
defaultMaxTokens = h.config.Conversation.Summary.MaxTokens
|
||||
if defaultMaxCompletionTokens == 0 {
|
||||
defaultMaxCompletionTokens = h.config.Conversation.Summary.MaxCompletionTokens
|
||||
}
|
||||
defaultNoMatchPrefix = h.config.Conversation.Summary.NoMatchPrefix
|
||||
|
||||
@@ -262,8 +262,8 @@ func (h *Handler) fillSummaryConfigDefaults(ctx context.Context, config *types.S
|
||||
if config.Temperature == 0 {
|
||||
config.Temperature = defaultTemperature
|
||||
}
|
||||
if config.MaxTokens == 0 {
|
||||
config.MaxTokens = defaultMaxTokens
|
||||
if config.MaxCompletionTokens == 0 {
|
||||
config.MaxCompletionTokens = defaultMaxCompletionTokens
|
||||
}
|
||||
if config.NoMatchPrefix == "" {
|
||||
config.NoMatchPrefix = defaultNoMatchPrefix
|
||||
|
||||
@@ -463,7 +463,9 @@ func (h *Handler) handleKnowledgeQARequest(
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
logger.ErrorWithFields(asyncCtx, errors.NewInternalServerError("Knowledge QA service panicked"), nil)
|
||||
buf := make([]byte, 10240)
|
||||
runtime.Stack(buf, true)
|
||||
logger.ErrorWithFields(asyncCtx, errors.NewInternalServerError(fmt.Sprintf("Knowledge QA service panicked: %v\n%s", r, string(buf))), nil)
|
||||
}
|
||||
}()
|
||||
err := h.sessionService.KnowledgeQA(asyncCtx, session, query, knowledgeBaseIDs, assistantMessage.ID, summaryModelID, webSearchEnabled, eventBus)
|
||||
|
||||
Reference in New Issue
Block a user