Skip to content

Commit

Permalink
Appending custom instruction to the preprompt
Browse files Browse the repository at this point in the history
  • Loading branch information
KartikGS committed Mar 5, 2024
1 parent e76995d commit c49f804
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@
model = data.models[0].id;
}
}
let customPreprompt = $settings.customPrompts[$settings.activeModel]
? $settings.customInstruction + "\n" + $settings.customPrompts[$settings.activeModel]
: undefined;
const res = await fetch(`${base}/conversation`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
model,
preprompt: $settings.customPrompts[$settings.activeModel],
preprompt: customPreprompt,
assistantId: data.assistant?._id,
}),
});
Expand Down
2 changes: 1 addition & 1 deletion src/routes/settings/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import CarbonCheckmark from "~icons/carbon/checkmark";
import CarbonAdd from "~icons/carbon/add";
import LicenseIcon from '~icons/carbon/license'
import LicenseIcon from "~icons/carbon/license";
import UserIcon from "~icons/carbon/user";
import { fade, fly } from "svelte/transition";
export let data;
Expand Down
6 changes: 2 additions & 4 deletions src/routes/settings/custom/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
$settings.customInstruction = "";
}
$: hasCustomInstruction =
$settings.customInstruction !== "";
$: hasCustomInstruction = $settings.customInstruction !== "";
</script>

<div class="flex flex-col items-start">
Expand All @@ -18,8 +17,7 @@
{#if hasCustomInstruction}
<button
class="ml-auto underline decoration-gray-300 hover:decoration-gray-700"
on:click|stopPropagation={() =>
($settings.customInstruction = "")}
on:click|stopPropagation={() => ($settings.customInstruction = "")}
>
Reset
</button>
Expand Down

0 comments on commit c49f804

Please sign in to comment.