refactor(api): drop deprecated tenant ConversationConfig field and KV write path
The Tenant.ConversationConfig field was marked deprecated when
CustomAgent (builtin-quick-answer) replaced the per-tenant defaults
path, but the JSONB column, GET/PUT KV handlers, write helpers and
read fall-throughs all stayed wired. This had two concrete failure
modes:
- Input-field.vue silently PUT-ed per-user model picks back into
/tenants/kv/conversation-config, which requires Admin+ — Viewers
and Contributors got a 403 every time they switched chat models.
- The same write also overwrote the tenant-shared default for every
other user, turning a per-user UX into a per-tenant footgun.
Remove the field, the struct, the validate helper, the PUT case and
the two dead Summary helpers in session/helpers.go. KnowledgeSearch
loses its tenant-conversation fallback (one chunk-tool reader); the
global config + hardcoded defaults still cover it. session_agent_qa
already required agents to declare their own rerank_model_id, so no
behaviour change there.
Frontend follows:
- Input-field.vue: per-user 'last selected chat model' moves to
localStorage, no API call.
- AgentEditorModal: defaults for builtin-quick-answer creation now
come from prompt-templates (system/context/rewrite/fallback) and
retrieval-config (top_k / threshold), the two endpoints that
actually own those settings now.
- AgentSettings.vue: orphan settings page with no router/import
referencing it; deleted.
- api/system: getConversationConfig / updateConversationConfig and
the ConversationConfig interface go away.
Net: 137 insertions, 2761 deletions.
This commit is contained in:
@@ -226,28 +226,13 @@ func (t *KnowledgeSearchTool) Execute(ctx context.Context, args json.RawMessage)
|
||||
|
||||
logger.Infof(ctx, "[Tool][KnowledgeSearch] Queries: %v", queries)
|
||||
|
||||
// Get search parameters from tenant conversation config, fallback to global config
|
||||
// Search parameters: fall back to global config, then to hardcoded defaults.
|
||||
// We used to read tenant.ConversationConfig here as the first source of
|
||||
// truth, but that field was removed when the chat pipeline moved to
|
||||
// CustomAgent — tenant-level KV settings now live on the agent itself.
|
||||
var topK int
|
||||
var vectorThreshold, keywordThreshold, minScore float64
|
||||
|
||||
// Try to get from tenant conversation config
|
||||
if tenantVal := ctx.Value(types.TenantInfoContextKey); tenantVal != nil {
|
||||
if tenant, ok := tenantVal.(*types.Tenant); ok && tenant != nil && tenant.ConversationConfig != nil {
|
||||
cc := tenant.ConversationConfig
|
||||
if cc.EmbeddingTopK > 0 {
|
||||
topK = cc.EmbeddingTopK
|
||||
}
|
||||
if cc.VectorThreshold > 0 {
|
||||
vectorThreshold = cc.VectorThreshold
|
||||
}
|
||||
if cc.KeywordThreshold > 0 {
|
||||
keywordThreshold = cc.KeywordThreshold
|
||||
}
|
||||
// minScore is not in ConversationConfig, use default or config
|
||||
minScore = 0.3
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to global config if not set
|
||||
if topK == 0 && t.config != nil {
|
||||
topK = t.config.Conversation.EmbeddingTopK
|
||||
|
||||
Reference in New Issue
Block a user