Add preview request data

This commit is contained in:
kwaroran
2025-03-16 19:24:59 +09:00
parent fef10c1e56
commit 5c53e16b85
3 changed files with 212 additions and 7 deletions

View File

@@ -13,7 +13,7 @@
import TextAreaInput from "../UI/GUI/TextAreaInput.svelte";
import { FolderUpIcon, PlusIcon, TrashIcon } from "lucide-svelte";
import { selectSingleFile } from "src/ts/util";
import { doingChat, previewFormated, sendChat } from "src/ts/process/index.svelte";
import { doingChat, previewFormated, previewBody, sendChat } from "src/ts/process/index.svelte";
import SelectInput from "../UI/GUI/SelectInput.svelte";
import { applyChatTemplate, chatTemplates } from "src/ts/process/templates/chatTemplate";
import OptionInput from "../UI/GUI/OptionInput.svelte";
@@ -31,7 +31,8 @@
}
alertWait("Loading...")
await sendChat(-1, {
preview: true
preview: previewJoin !== 'prompt',
previewPrompt: previewJoin === 'prompt'
})
let md = ''
@@ -41,6 +42,15 @@
"system": "⚙️ System",
"assistant": "✨ Assistant",
}
if(previewJoin === 'prompt'){
md += '### Prompt\n'
md += '```json\n' + JSON.stringify(JSON.parse(previewBody), null, 2).replaceAll('```', '\\`\\`\\`') + '\n```\n'
$doingChat = false
alertMd(md)
return
}
let formated = safeStructuredClone(previewFormated)
if(previewJoin === 'yes'){
@@ -252,6 +262,7 @@
<SelectInput bind:value={previewJoin}>
<OptionInput value="yes">With Join</OptionInput>
<OptionInput value="no">Without Join</OptionInput>
<OptionInput value="prompt">As Request</OptionInput>
</SelectInput>
<Button className="mt-2" onclick={() => {preview()}}>Run</Button>
</Arcodion>