diff --git a/.gitignore b/.gitignore index 1250aef9..528e1f83 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,6 @@ dist/ downloads/ eggs/ .eggs/ -lib/ lib64/ parts/ sdist/ diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index d2fe8ca2..55683329 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -1,8 +1,11 @@ + +{#if filteredPromptCommands.length > 0} +
+
+
+
/
+
+
+ {#each filteredPromptCommands as command, commandIdx} + + {/each} +
+
+
+{/if} diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index 8f7e711b..344672da 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -111,3 +111,19 @@ export const checkVersion = (required, current) => { caseFirst: 'upper' }) < 0; }; + +export const findWordIndices = (text) => { + const regex = /\[([^\]]+)\]/g; + let matches = []; + let match; + + while ((match = regex.exec(text)) !== null) { + matches.push({ + word: match[1], + startIndex: match.index, + endIndex: regex.lastIndex - 1 + }); + } + + return matches; +};