diff --git a/src/lib/helpers/types/agentTypes.js b/src/lib/helpers/types/agentTypes.js index b68a9b0d..1059e53a 100644 --- a/src/lib/helpers/types/agentTypes.js +++ b/src/lib/helpers/types/agentTypes.js @@ -128,6 +128,7 @@ /** * @typedef {Object} UtilityBase * @property {string} name + * @property {string?} [displayName] */ export default {}; \ No newline at end of file diff --git a/src/lib/helpers/utils/common.js b/src/lib/helpers/utils/common.js index 84b5d2ef..d3ae5566 100644 --- a/src/lib/helpers/utils/common.js +++ b/src/lib/helpers/utils/common.js @@ -50,4 +50,21 @@ export function formatObject(object) { } catch { return object; } +} + + +/** + * @param {string?} str + * @param {string?} prefix + */ +export function truncateByPrefix(str, prefix) { + if (!str || !prefix) { + return str; + } + + if (!str.startsWith(prefix)) { + return str; + } + + return str.replace(prefix, ''); } \ No newline at end of file diff --git a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte index 8220910d..94378811 100644 --- a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte +++ b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte @@ -1759,7 +1759,7 @@ {#if !!lastBotMsg && !isSendingMsg && !isThinking} confirmSelectedOption(title, payload)} /> {/if} @@ -1843,7 +1843,7 @@