feat: Revamp conversation configuration management and enhance localization

- Removed outdated DEVELOPMENT.md, consolidating development instructions into relevant documentation.
- Updated conversation configuration to include new parameters such as max rounds, embedding thresholds, and rewrite prompts.
- Enhanced UI components to support new conversation settings, including AgentSettings.vue and related views.
- Improved localization in English, Russian, and Chinese for new conversation configuration fields and UI elements.
- Implemented logic to apply tenant-specific conversation settings, ensuring defaults are respected.
This commit is contained in:
wizardchen
2025-11-18 23:18:43 +08:00
parent 60240ee337
commit ddf6b4e748
36 changed files with 2941 additions and 1914 deletions
+16 -4
View File
@@ -6,7 +6,8 @@ type ChatManage struct {
SessionID string `json:"session_id"` // Unique identifier for the chat session
Query string `json:"query,omitempty"` // Original user query
ProcessedQuery string `json:"processed_query,omitempty"` // Query after preprocessing
RewriteQuery string `json:"rewrite_query,omitempty"` // Query after rewriting for better retrieval
RewriteQuery string `json:"rewrite_query,omitempty"` // Query after rewriting for better retrieval
QueryIntent string `json:"query_intent,omitempty"` // Parsed intent: definition/howto/compare/qa/general
History []*History `json:"history,omitempty"` // Chat history for context
KnowledgeBaseID string `json:"knowledge_base_id"` // ID of the knowledge base to search against (deprecated, use KnowledgeBaseIDs)
@@ -20,11 +21,17 @@ type ChatManage struct {
RerankTopK int `json:"rerank_top_k"` // Number of top results after reranking
RerankThreshold float64 `json:"rerank_threshold"` // Minimum score threshold for reranked results
MaxRounds int `json:"max_rounds"` // Maximum history rounds used for rewrite/context
ChatModelID string `json:"chat_model_id"` // ID of the chat model to use
SummaryConfig SummaryConfig `json:"summary_config"` // Configuration for summary generation
FallbackStrategy FallbackStrategy `json:"fallback_strategy"` // Strategy when no relevant results are found
FallbackResponse string `json:"fallback_response"` // Default response when fallback occurs
EnableRewrite bool `json:"enable_rewrite"` // Whether to enable rewrite
RewritePromptSystem string `json:"rewrite_prompt_system"` // Custom system prompt for rewrite stage
RewritePromptUser string `json:"rewrite_prompt_user"` // Custom user prompt for rewrite stage
// Internal fields for pipeline data processing
SearchResult []*SearchResult `json:"-"` // Results from search phase
RerankResult []*SearchResult `json:"-"` // Results after reranking
@@ -52,13 +59,15 @@ func (c *ChatManage) Clone() *ChatManage {
return &ChatManage{
Query: c.Query,
ProcessedQuery: c.ProcessedQuery,
RewriteQuery: c.RewriteQuery,
RewriteQuery: c.RewriteQuery,
QueryIntent: c.QueryIntent,
SessionID: c.SessionID,
KnowledgeBaseID: c.KnowledgeBaseID,
KnowledgeBaseIDs: knowledgeBaseIDs,
VectorThreshold: c.VectorThreshold,
KeywordThreshold: c.KeywordThreshold,
EmbeddingTopK: c.EmbeddingTopK,
MaxRounds: c.MaxRounds,
VectorDatabase: c.VectorDatabase,
RerankModelID: c.RerankModelID,
RerankTopK: c.RerankTopK,
@@ -78,8 +87,11 @@ func (c *ChatManage) Clone() *ChatManage {
Seed: c.SummaryConfig.Seed,
MaxCompletionTokens: c.SummaryConfig.MaxCompletionTokens,
},
FallbackStrategy: c.FallbackStrategy,
FallbackResponse: c.FallbackResponse,
FallbackStrategy: c.FallbackStrategy,
FallbackResponse: c.FallbackResponse,
RewritePromptSystem: c.RewritePromptSystem,
RewritePromptUser: c.RewritePromptUser,
EnableRewrite: c.EnableRewrite,
}
}
+26 -2
View File
@@ -74,14 +74,38 @@ func (c *RetrieverEngines) Scan(value interface{}) error {
// ConversationConfig represents the conversation configuration for normal mode
type ConversationConfig struct {
// Prompt is the system prompt
Prompt string `json:"prompt"`
// Prompt is the system prompt for normal mode
UseCustomSystemPrompt bool `json:"use_custom_system_prompt"`
Prompt string `json:"prompt"`
UseCustomContextTemplate bool `json:"use_custom_context_template"`
// 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"`
// Retrieval & strategy parameters
MaxRounds int `json:"max_rounds"`
EmbeddingTopK int `json:"embedding_top_k"`
KeywordThreshold float64 `json:"keyword_threshold"`
VectorThreshold float64 `json:"vector_threshold"`
RerankTopK int `json:"rerank_top_k"`
RerankThreshold float64 `json:"rerank_threshold"`
EnableRewrite bool `json:"enable_rewrite"`
// Model configuration
SummaryModelID string `json:"summary_model_id"`
RerankModelID string `json:"rerank_model_id"`
// Fallback strategy
FallbackStrategy string `json:"fallback_strategy"`
FallbackResponse string `json:"fallback_response"`
FallbackPrompt string `json:"fallback_prompt"`
// Rewrite prompts
RewritePromptSystem string `json:"rewrite_prompt_system"`
RewritePromptUser string `json:"rewrite_prompt_user"`
}
// Value implements the driver.Valuer interface, used to convert ConversationConfig to database value