Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
refactor: Clean up and organize code structure in initialization and request modules for improved maintainability
begoniezhao15603dbac71e
diff --git a/frontend/src/api/initialization/index.ts b/frontend/src/api/initialization/index.tsindex a3d0ac33c..7ec62baf1 100644--- a/frontend/src/api/initialization/index.ts+++ b/frontend/src/api/initialization/index.ts@@ -397,7 +397,7 @@ export function testMultimodalFunction(testData: {export interface TextRelationExtractionRequest {text: string;tags: string[];- llmConfig: LLMConfig;+ llm_config: LLMConfig;}export interface Node {@@ -413,9 +413,9 @@ export interface Relation {export interface LLMConfig {source: 'local' | 'remote';- modelName: string;- baseUrl: string;- apiKey: string;+ model_name: string;+ base_url: string;+ api_key: string;}export interface TextRelationExtractionResponse {@@ -426,7 +426,7 @@ export interface TextRelationExtractionResponse {// 文本内容关系提取export function extractTextRelations(request: TextRelationExtractionRequest): Promise<TextRelationExtractionResponse> {return new Promise((resolve, reject) => {- post('/api/v1/initialization/extract/text-relation', request)+ post('/api/v1/initialization/extract/text-relation', request, { timeout: 60000 }).then((response: any) => {resolve(response.data || { nodes: [], relations: [] });})@@ -439,7 +439,7 @@ export function extractTextRelations(request: TextRelationExtractionRequest): Prexport interface FabriTextRequest {tags: string[];- llmConfig: LLMConfig;+ llm_config: LLMConfig;}export interface FabriTextResponse {@@ -461,7 +461,7 @@ export function fabriText(request: FabriTextRequest): Promise<FabriTextResponse>}export interface FabriTagRequest {- llmConfig: LLMConfig;+ llm_config: LLMConfig;}export interface FabriTagResponse {diff --git a/frontend/src/utils/request.ts b/frontend/src/utils/request.tsindex 3aacba796..cdac619cc 100644--- a/frontend/src/utils/request.ts+++ b/frontend/src/utils/request.ts@@ -186,8 +186,8 @@ export function postChat(url: string, data = {}) {});}-export function post(url: string, data = {}) {- return instance.post(url, data);+export function post(url: string, data = {}, config?: any) {+ return instance.post(url, data, config);}export function put(url: string, data = {}) {diff --git a/frontend/src/views/knowledge/settings/GraphSettings.vue b/frontend/src/views/knowledge/settings/GraphSettings.vueindex 8386b7be3..02fd88820 100644--- a/frontend/src/views/knowledge/settings/GraphSettings.vue+++ b/frontend/src/views/knowledge/settings/GraphSettings.vue@@ -446,7 +446,7 @@ const handleFabriTag = async () => {tagFabring.value = truetry {const response = await fabriTag({- llmConfig: modelStatus.value.llm.config+ llm_config: modelStatus.value.llm.config})localGraphExtract.value.tags = response.tags || []handleTagsChange()@@ -470,7 +470,7 @@ const handleFabriText = async () => {try {const response = await fabriText({tags: localGraphExtract.value.tags,- llmConfig: modelStatus.value.llm.config+ llm_config: modelStatus.value.llm.config})localGraphExtract.value.text = response.text || ''handleTextChange()@@ -500,7 +500,7 @@ const handleExtract = async () => {const response = await extractTextRelations({text: localGraphExtract.value.text,tags: localGraphExtract.value.tags,- llmConfig: modelStatus.value.llm.config+ llm_config: modelStatus.value.llm.config})localGraphExtract.value.nodes = response.nodes || []localGraphExtract.value.relations = response.relations || []@@ -555,9 +555,9 @@ const loadModelStatus = async () => {modelStatus.value.llm.available = truemodelStatus.value.llm.config = {source: llmModel.source,- modelName: llmModel.name,- baseUrl: llmModel.parameters?.base_url || '',- apiKey: llmModel.parameters?.api_key || ''+ model_name: llmModel.name,+ base_url: llmModel.parameters?.base_url || '',+ api_key: llmModel.parameters?.api_key || ''}}} catch (error: any) {diff --git a/internal/handler/initialization.go b/internal/handler/initialization.goindex 3c8676314..b3ce67787 100644--- a/internal/handler/initialization.go+++ b/internal/handler/initialization.go@@ -1771,14 +1771,14 @@ func (h *InitializationHandler) testMultimodalWithDocReader(type TextRelationExtractionRequest struct {Text string `json:"text" binding:"required"`Tags []string `json:"tags" binding:"required"`- LLMConfig LLMConfig `json:"llmConfig"`+ LLMConfig LLMConfig `json:"llm_config"`}type LLMConfig struct {Source string `json:"source"`- ModelName string `json:"modelName"`- BaseUrl string `json:"baseUrl"`- ApiKey string `json:"apiKey"`+ ModelName string `json:"model_name"`+ BaseUrl string `json:"base_url"`+ ApiKey string `json:"api_key"`}// TextRelationExtractionResponse 文本关系提取响应结构@@ -1871,7 +1871,7 @@ func (h *InitializationHandler) extractRelationsFromText(type FabriTextRequest struct {Tags []string `json:"tags"`- LLMConfig LLMConfig `json:"llmConfig"`+ LLMConfig LLMConfig `json:"llm_config"`}type FabriTextResponse struct {@@ -1936,7 +1936,7 @@ func (h *InitializationHandler) fabriText(ctx context.Context, tags []string, ll}type FabriTagRequest struct {- LLMConfig LLMConfig `json:"llmConfig"`+ LLMConfig LLMConfig `json:"llm_config"`}type FabriTagResponse struct {