Skip to content

Commit eec7167

Browse files
updates fetching the user context and also properly adds it to the system template
1 parent 3abb431 commit eec7167

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

apps/desktop/src/components/editor-area/index.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ import { FloatingButton } from "./floating-button";
2929
import { NoteHeader } from "./note-header";
3030
import { TextSelectionPopover } from "./text-selection-popover";
3131

32-
const getUserContext = async (): Promise<{ value: string } | null> => {
32+
const getUserContext = async (): Promise<string | null> => {
3333
try {
34-
const store = await load("store.json", { autoSave: false })
35-
const val = await store.get("user_context")
36-
if (val && typeof val === "object" && "value" in val) {
37-
return val as { value: string }
34+
const store = await load("store.json", { autoSave: false });
35+
const val = await store.get("user_context");
36+
if (val && typeof val === "object" && "value" in val && typeof (val as any).value === "string") {
37+
return (val as { value: string }).value;
3838
}
39-
return null
39+
return null;
4040
} catch (error) {
41-
console.error("Failed to fetch user context", error)
42-
return null
41+
console.error("Failed to fetch user context", error);
42+
return null;
4343
}
4444
}
4545

@@ -466,7 +466,7 @@ export function useEnhanceMutation({
466466

467467
let customInstruction = selectedTemplate?.description;
468468

469-
let userContext = await getUserContext() || "";
469+
const userContext = (await getUserContext()) ?? "";
470470

471471
const systemMessage = await templateCommands.render(
472472
"enhance.system",

crates/template/assets/enhance.system.jinja

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,22 @@ You will be given multiple inputs from the user. Below are useful information th
5656
- Meeting Information (txt)
5757
- Raw Note (txt)
5858
- Meeting Transcript (txt)
59+
- User Context (txt)
60+
61+
-The User Context contains important background details about the user, such as their role, company, ongoing projects, style/tone preferences, and domain terminology.
62+
-You must always take this into account when generating enhanced notes to make them more relevant and personalized.
63+
64+
{% if userContext %}
65+
Here is the User Context:
66+
{{ userContext | trim }}
67+
{% endif %}
5968

6069
# About Raw Notes
6170

6271
- Raw Notes is what user purely wrote during the meeting.
6372
- The beginning of a raw note may include agenda items, discussion topics, and preliminary questions.
6473
- Primarily consist of key phrases or sentences the user wants to remember, though they may also contain random or extraneous words.
6574
- May sometimes be empty.
66-
- User Context (txt)
67-
68-
The User Context contains important background details about the user, such as their role, company, ongoing projects, style/tone preferences, and domain terminology.
69-
You must always take this into account when generating enhanced notes to make them more relevant and personalized.
70-
71-
Here is the User Context:
72-
{{ userContext}}
7375

7476
# Enhanced Note Format
7577

0 commit comments

Comments
 (0)