mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 11:57:51 +01:00
enh: tool calling support in quick actions
This commit is contained in:
@@ -82,6 +82,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let prompt = selectedAction?.prompt ?? '';
|
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) {
|
if (prompt.includes('{{INPUT_CONTENT}}') && !floatingInput) {
|
||||||
prompt = prompt.replace('{{INPUT_CONTENT}}', floatingInputValue);
|
prompt = prompt.replace('{{INPUT_CONTENT}}', floatingInputValue);
|
||||||
floatingInputValue = '';
|
floatingInputValue = '';
|
||||||
@@ -106,6 +116,15 @@
|
|||||||
role: message.role,
|
role: message.role,
|
||||||
content: message.content
|
content: message.content
|
||||||
})),
|
})),
|
||||||
|
...(toolIds.length > 0
|
||||||
|
? {
|
||||||
|
tool_ids: toolIds
|
||||||
|
// params: {
|
||||||
|
// function_calling: 'native'
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
|
||||||
stream: true // Enable streaming
|
stream: true // Enable streaming
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user