refactor: Clean up and organize code structure in initialization and request modules for improved maintainability
This commit is contained in:
@@ -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): Pr
|
||||
|
||||
export 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 {
|
||||
|
||||
@@ -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 = {}) {
|
||||
|
||||
@@ -446,7 +446,7 @@ const handleFabriTag = async () => {
|
||||
tagFabring.value = true
|
||||
try {
|
||||
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 = true
|
||||
modelStatus.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) {
|
||||
|
||||
Reference in New Issue
Block a user