Skip to content

Commit c49f804

Browse files
committed
Appending custom instruction to the preprompt
1 parent e76995d commit c49f804

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/routes/+page.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@
3434
model = data.models[0].id;
3535
}
3636
}
37+
let customPreprompt = $settings.customPrompts[$settings.activeModel]
38+
? $settings.customInstruction + "\n" + $settings.customPrompts[$settings.activeModel]
39+
: undefined;
3740
const res = await fetch(`${base}/conversation`, {
3841
method: "POST",
3942
headers: {
4043
"Content-Type": "application/json",
4144
},
4245
body: JSON.stringify({
4346
model,
44-
preprompt: $settings.customPrompts[$settings.activeModel],
47+
preprompt: customPreprompt,
4548
assistantId: data.assistant?._id,
4649
}),
4750
});

src/routes/settings/+layout.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import CarbonCheckmark from "~icons/carbon/checkmark";
1111
import CarbonAdd from "~icons/carbon/add";
1212
13-
import LicenseIcon from '~icons/carbon/license'
13+
import LicenseIcon from "~icons/carbon/license";
1414
import UserIcon from "~icons/carbon/user";
1515
import { fade, fly } from "svelte/transition";
1616
export let data;

src/routes/settings/custom/+page.svelte

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
$settings.customInstruction = "";
88
}
99
10-
$: hasCustomInstruction =
11-
$settings.customInstruction !== "";
10+
$: hasCustomInstruction = $settings.customInstruction !== "";
1211
</script>
1312

1413
<div class="flex flex-col items-start">
@@ -18,8 +17,7 @@
1817
{#if hasCustomInstruction}
1918
<button
2019
class="ml-auto underline decoration-gray-300 hover:decoration-gray-700"
21-
on:click|stopPropagation={() =>
22-
($settings.customInstruction = "")}
20+
on:click|stopPropagation={() => ($settings.customInstruction = "")}
2321
>
2422
Reset
2523
</button>

0 commit comments

Comments
 (0)