perf: backup import (#4866)

* i18n

* remove invalid code

* perf: backup import

* backup tip

* fix: indexsize invalid
This commit is contained in:
Archer
2025-05-22 15:53:51 +08:00
committed by GitHub
parent dd3c251603
commit 88bd3aaa9e
67 changed files with 751 additions and 388 deletions

View File

@@ -223,28 +223,29 @@ const toolChoice = async (props: ActionProps) => {
}
];
const body = llmCompletionsBodyFormat(
{
stream: true,
model: extractModel.model,
temperature: 0.01,
messages: filterMessages,
tools,
tool_choice: { type: 'function', function: { name: agentFunName } }
},
extractModel
);
const { response } = await createChatCompletion({
body: llmCompletionsBodyFormat(
{
stream: true,
model: extractModel.model,
temperature: 0.01,
messages: filterMessages,
tools,
tool_choice: { type: 'function', function: { name: agentFunName } }
},
extractModel
),
body,
userKey: externalProvider.openaiAccount
});
const { toolCalls, usage } = await formatLLMResponse(response);
const { text, toolCalls, usage } = await formatLLMResponse(response);
const arg: Record<string, any> = (() => {
try {
return json5.parse(toolCalls?.[0]?.function?.arguments || '');
} catch (error) {
console.log(agentFunction.parameters);
console.log(toolCalls?.[0]?.function);
console.log('body', body);
console.log('AI response', text, toolCalls?.[0]?.function);
console.log('Your model may not support tool_call', error);
return {};
}

View File

@@ -211,12 +211,12 @@ export const getFileContentFromLinks = async ({
// Read file
const { rawText } = await readRawContentByFileBuffer({
extension,
isQAImport: false,
teamId,
tmbId,
buffer,
encoding,
customPdfParse
customPdfParse,
getFormatText: true
});
// Add to buffer