mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-18 13:10:40 +01:00
Fix tools-list
This commit is contained in:
parent
077ba8b03d
commit
96862be6b0
@ -612,3 +612,7 @@ ul.li-padding-bot5 li {
|
||||
ul.li-padding-bot10 li {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.wordBreakAll {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ export const slashCommandReturnHelper = {
|
||||
case 'toast-html': {
|
||||
const htmlOrNotHtml = shouldHtml ? DOMPurify.sanitize((new showdown.Converter()).makeHtml(stringValue)) : escapeHtml(stringValue);
|
||||
|
||||
if (type.startsWith('popup')) await callGenericPopup(htmlOrNotHtml, POPUP_TYPE.TEXT);
|
||||
if (type.startsWith('popup')) await callGenericPopup(htmlOrNotHtml, POPUP_TYPE.TEXT, '', { allowVerticalScrolling: true, wide: true });
|
||||
if (type.startsWith('chat')) sendSystemMessage(system_message_types.GENERIC, htmlOrNotHtml);
|
||||
if (type.startsWith('toast')) toastr.info(htmlOrNotHtml, null, { escapeHtml: !shouldHtml });
|
||||
|
||||
|
@ -158,8 +158,8 @@ class ToolDefinition {
|
||||
description: this.#description,
|
||||
parameters: this.#parameters,
|
||||
},
|
||||
toString: (/** @type {ToolDefinitionOpenAI} */ tool) => {
|
||||
return `${tool?.function?.name} - ${tool?.function?.description}\n${JSON.stringify(tool?.function?.parameters, null, 2)}`;
|
||||
toString: function() {
|
||||
return `<div><b>${this.function.name}</b></div><div><small>${this.function.description}</small></div><pre class="justifyLeft wordBreakAll"><code class="flex padding5">${JSON.stringify(this.function.parameters, null, 2)}</code></pre><hr>`;
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -666,7 +666,7 @@ export class ToolManager {
|
||||
callback: async (args) => {
|
||||
/** @type {any} */
|
||||
const returnType = String(args?.return ?? 'popup-html').trim().toLowerCase();
|
||||
const objectToStringFunc = (tool) => tool.toString();
|
||||
const objectToStringFunc = (tools) => Array.isArray(tools) ? tools.map(x => x.toString()).join('\n\n') : tools.toString();
|
||||
const tools = ToolManager.tools.map(tool => tool.toFunctionOpenAI());
|
||||
return await slashCommandReturnHelper.doReturn(returnType ?? 'popup-html', tools ?? [], { objectToStringFunc });
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user