Skip to content

Commit c9d448a

Browse files
committed
Don't run script selections when running scripts
1 parent 1c015b7 commit c9d448a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

llms/extensions/browser/ui/index.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const BrowserPage = {
134134
</div>
135135
<div class="flex flex-col gap-1 overflow-y-auto">
136136
<div v-for="script in scripts" :key="script.name" class="flex gap-1 items-center text-sm">
137-
<button type="button" @click.stop="runScript(script.name)" class="opacity-60 hover:opacity-100 text-green-700 dark:text-green-600" :title="'Run ' + script.name">▶</button>
137+
<button type="button" @click.stop="runScript(script.name, { forceScript: true })" class="opacity-60 hover:opacity-100 text-green-700 dark:text-green-600" :title="'Run ' + script.name">▶</button>
138138
<div @click.stop="editScript(script)" class="flex justify-between items-center w-full text-xs w-full">
139139
<div class="flex items-center gap-1 text-gray-600 dark:text-gray-400 cursor-pointer hover:text-gray-700 dark:hover:text-gray-300">
140140
{{ script.name }}
@@ -725,7 +725,7 @@ const BrowserPage = {
725725
}
726726
}
727727

728-
async function runScript(name) {
728+
async function runScript(name, { forceScript } = {}) {
729729
loading.value = true
730730
try {
731731
const selectedText = cmEditor ? cmEditor.getSelection() : ''
@@ -738,7 +738,7 @@ const BrowserPage = {
738738
savedScriptContent.value = scriptContent.value
739739
await fetchScripts()
740740
}
741-
const res = selectedText
741+
const res = selectedText && !forceScript
742742
? await postBrowser('/exec', { content: selectedText })
743743
: await postBrowser(`/scripts/${name}/run`)
744744
console.log('Script output:', res)

0 commit comments

Comments
 (0)