mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-13 04:45:19 +00:00
enh: tool calling support in quick actions
This commit is contained in:
parent
ff9f2614f3
commit
056431606b
1 changed files with 19 additions and 0 deletions
|
|
@ -82,6 +82,16 @@
|
|||
}
|
||||
|
||||
let prompt = selectedAction?.prompt ?? '';
|
||||
let toolIds = [];
|
||||
|
||||
let toolIdPattern = /\{\{TOOL:([^\}]+)\}\}/g;
|
||||
let match;
|
||||
while ((match = toolIdPattern.exec(prompt)) !== null) {
|
||||
toolIds.push(match[1]);
|
||||
}
|
||||
// Remove all TOOL placeholders from the prompt
|
||||
prompt = prompt.replace(toolIdPattern, '');
|
||||
|
||||
if (prompt.includes('{{INPUT_CONTENT}}') && !floatingInput) {
|
||||
prompt = prompt.replace('{{INPUT_CONTENT}}', floatingInputValue);
|
||||
floatingInputValue = '';
|
||||
|
|
@ -106,6 +116,15 @@
|
|||
role: message.role,
|
||||
content: message.content
|
||||
})),
|
||||
...(toolIds.length > 0
|
||||
? {
|
||||
tool_ids: toolIds
|
||||
// params: {
|
||||
// function_calling: 'native'
|
||||
// }
|
||||
}
|
||||
: {}),
|
||||
|
||||
stream: true // Enable streaming
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue