feat: Update VLM configuration in knowledge base and API documentation
- Replaced `vlm_model_id` with a structured `vlm_config` object in knowledge base configurations, including `enabled` flag and `model_id`. - Updated API documentation to reflect changes in VLM configuration structure. - Enhanced frontend interfaces to accommodate new VLM configuration format. - Improved localization for new features related to knowledge graph and multimodal capabilities.
This commit is contained in:
@@ -36,7 +36,8 @@ func NewDatabaseQueryTool(db *gorm.DB, tenantID uint) *DatabaseQueryTool {
|
||||
- name (VARCHAR): Knowledge base name
|
||||
- description (TEXT): Description
|
||||
- tenant_id (INTEGER): Owner tenant ID
|
||||
- embedding_model_id, summary_model_id, rerank_model_id, vlm_model_id (VARCHAR): Model IDs
|
||||
- embedding_model_id, summary_model_id, rerank_model_id (VARCHAR): Model IDs
|
||||
- vlm_config (JSON): Includes VLM settings such as enabled flag and model_id
|
||||
- created_at, updated_at (TIMESTAMP)
|
||||
|
||||
### knowledges (documents)
|
||||
|
||||
@@ -133,11 +133,19 @@ func (t *GetDocumentInfoTool) Execute(ctx context.Context, args map[string]inter
|
||||
}
|
||||
|
||||
// Get chunk count
|
||||
chunks, err := t.chunkService.GetRepository().ListChunksByKnowledgeID(ctx, t.tenantID, id)
|
||||
chunkCount := 0
|
||||
if err == nil {
|
||||
chunkCount = len(chunks)
|
||||
_, total, err := t.chunkService.GetRepository().ListPagedChunksByKnowledgeID(ctx, t.tenantID, id, &types.Pagination{
|
||||
Page: 1,
|
||||
PageSize: 1000,
|
||||
}, []types.ChunkType{"text"}, "")
|
||||
if err != nil {
|
||||
mu.Lock()
|
||||
results[id] = &docInfo{
|
||||
err: fmt.Errorf("无法获取文档信息: %v", err),
|
||||
}
|
||||
mu.Unlock()
|
||||
return
|
||||
}
|
||||
chunkCount := int(total)
|
||||
|
||||
mu.Lock()
|
||||
results[id] = &docInfo{
|
||||
@@ -220,26 +228,21 @@ func (t *GetDocumentInfoTool) Execute(ctx context.Context, args map[string]inter
|
||||
output += "\n"
|
||||
|
||||
formattedDocs = append(formattedDocs, map[string]interface{}{
|
||||
"knowledge_id": k.ID,
|
||||
"title": k.Title,
|
||||
"description": k.Description,
|
||||
"type": k.Type,
|
||||
"source": k.Source,
|
||||
"file_name": k.FileName,
|
||||
"file_type": k.FileType,
|
||||
"file_size": k.FileSize,
|
||||
"parse_status": k.ParseStatus,
|
||||
"chunk_count_min": doc.chunkCount,
|
||||
"metadata": k.GetMetadata(),
|
||||
"type_icon": typeIcon,
|
||||
"knowledge_id": k.ID,
|
||||
"title": k.Title,
|
||||
"description": k.Description,
|
||||
"type": k.Type,
|
||||
"source": k.Source,
|
||||
"file_name": k.FileName,
|
||||
"file_type": k.FileType,
|
||||
"file_size": k.FileSize,
|
||||
"parse_status": k.ParseStatus,
|
||||
"chunk_count": doc.chunkCount,
|
||||
"metadata": k.GetMetadata(),
|
||||
"type_icon": typeIcon,
|
||||
})
|
||||
}
|
||||
|
||||
output += "=== Usage Tips ===\n"
|
||||
output += "- Use knowledge_search to search document content\n"
|
||||
output += "- Use list_knowledge_chunks to view context and related chunks\n"
|
||||
output += "- Search results already contain full chunk content\n"
|
||||
|
||||
// Extract first document title for summary
|
||||
var firstTitle string
|
||||
if len(successDocs) > 0 && successDocs[0].knowledge != nil {
|
||||
|
||||
Reference in New Issue
Block a user