feat: Refactor tenant configuration management to use KV API

- Updated tenant web search and agent configuration endpoints to utilize a KV-style API for better flexibility.
- Enhanced the tenant handler to support generic key-value operations for retrieving and updating configurations.
- Improved frontend API calls to align with the new KV API structure, ensuring consistent data handling.
- Removed deprecated direct configuration endpoints for a cleaner and more maintainable codebase.
This commit is contained in:
wizardchen
2025-11-10 20:11:45 +08:00
parent 07a8c1de4c
commit ac8c8e9af2
8 changed files with 201 additions and 178 deletions
+24
View File
@@ -5,6 +5,12 @@ import (
"strings"
)
const (
DefaultAgentTemperature = 0.7
DefaultAgentMaxIterations = 20
DefaultAgentReflectionEnabled = false
)
// formatFileSize formats file size in human-readable format
func formatFileSize(size int64) string {
const (
@@ -42,6 +48,24 @@ type KnowledgeBaseInfo struct {
RecentDocs []RecentDocInfo // Recently added documents (up to 10)
}
// PlaceholderDefinition defines a placeholder exposed to UI/configuration
type PlaceholderDefinition struct {
Name string `json:"name"`
Label string `json:"label"`
Description string `json:"description"`
}
// AvailablePlaceholders lists all supported prompt placeholders for UI hints
func AvailablePlaceholders() []PlaceholderDefinition {
return []PlaceholderDefinition{
{
Name: "knowledge_bases",
Label: "知识库列表",
Description: "自动格式化为表格形式的知识库列表,包含知识库名称、描述、文档数量、最近添加的文档等信息",
},
}
}
// formatKnowledgeBaseList formats knowledge base information for the prompt
func formatKnowledgeBaseList(kbInfos []*KnowledgeBaseInfo) string {
if len(kbInfos) == 0 {