Fix tools-list

96862be6b02a4a0b4a9ff13ed7ca2486c8ea89f8

Cohee <18619528+Cohee1207@users.noreply.github.com>

3 files changed, +8 -4Ignore whitespace
public/css/st-tailwind.css+4 -0
@@ -612,3 +612,7 @@ ul.li-padding-bot5 li {
612ul.li-padding-bot10 li {612ul.li-padding-bot10 li {
613 padding-bottom: 10px;613 padding-bottom: 10px;
614}614}
615
616.wordBreakAll {
617 word-break: break-all;
618}
public/scripts/slash-commands/SlashCommandReturnHelper.js+1 -1
@@ -58,7 +58,7 @@ export const slashCommandReturnHelper = {
58 case 'toast-html': {58 case 'toast-html': {
59 const htmlOrNotHtml = shouldHtml ? DOMPurify.sanitize((new showdown.Converter()).makeHtml(stringValue)) : escapeHtml(stringValue);59 const htmlOrNotHtml = shouldHtml ? DOMPurify.sanitize((new showdown.Converter()).makeHtml(stringValue)) : escapeHtml(stringValue);
6060
61 if (type.startsWith('popup')) await callGenericPopup(htmlOrNotHtml, POPUP_TYPE.TEXT);61 if (type.startsWith('popup')) await callGenericPopup(htmlOrNotHtml, POPUP_TYPE.TEXT, '', { allowVerticalScrolling: true, wide: true });
62 if (type.startsWith('chat')) sendSystemMessage(system_message_types.GENERIC, htmlOrNotHtml);62 if (type.startsWith('chat')) sendSystemMessage(system_message_types.GENERIC, htmlOrNotHtml);
63 if (type.startsWith('toast')) toastr.info(htmlOrNotHtml, null, { escapeHtml: !shouldHtml });63 if (type.startsWith('toast')) toastr.info(htmlOrNotHtml, null, { escapeHtml: !shouldHtml });
6464
public/scripts/tool-calling.js+3 -3
@@ -158,8 +158,8 @@ class ToolDefinition {
158 description: this.#description,158 description: this.#description,
159 parameters: this.#parameters,159 parameters: this.#parameters,
160 },160 },
161 toString: (/** @type {ToolDefinitionOpenAI} */ tool) => {161 toString: function() {
162 return `${tool?.function?.name} - ${tool?.function?.description}\n${JSON.stringify(tool?.function?.parameters, null, 2)}`;162 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>`;
163 },163 },
164 };164 };
165 }165 }
@@ -666,7 +666,7 @@ export class ToolManager {
666 callback: async (args) => {666 callback: async (args) => {
667 /** @type {any} */667 /** @type {any} */
668 const returnType = String(args?.return ?? 'popup-html').trim().toLowerCase();668 const returnType = String(args?.return ?? 'popup-html').trim().toLowerCase();
669 const objectToStringFunc = (tool) => tool.toString();669 const objectToStringFunc = (tools) => Array.isArray(tools) ? tools.map(x => x.toString()).join('\n\n') : tools.toString();
670 const tools = ToolManager.tools.map(tool => tool.toFunctionOpenAI());670 const tools = ToolManager.tools.map(tool => tool.toFunctionOpenAI());
671 return await slashCommandReturnHelper.doReturn(returnType ?? 'popup-html', tools ?? [], { objectToStringFunc });671 return await slashCommandReturnHelper.doReturn(returnType ?? 'popup-html', tools ?? [], { objectToStringFunc });
672 },672 },