Skip to content

Commit fa9792d

Browse files
committed
remove legacy enhanced_md from session store (#2765)
1 parent 508546d commit fa9792d

File tree

35 files changed

+307
-773
lines changed

35 files changed

+307
-773
lines changed

apps/desktop/src/components/chat/message/tool/search.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@ function RenderContent({ part }: { part: Part }) {
9898

9999
function RenderSession({ sessionId }: { sessionId: string }) {
100100
const session = main.UI.useRow("sessions", sessionId, main.STORE_ID);
101+
const enhancedNoteIds = main.UI.useSliceRowIds(
102+
main.INDEXES.enhancedNotesBySession,
103+
sessionId,
104+
main.STORE_ID,
105+
);
106+
const firstEnhancedNoteId = enhancedNoteIds?.[0];
107+
const enhancedNoteContent = main.UI.useCell(
108+
"enhanced_notes",
109+
firstEnhancedNoteId ?? "",
110+
"content",
111+
main.STORE_ID,
112+
);
101113
const openNew = useTabs((state) => state.openNew);
102114

103115
const handleClick = useCallback(() => {
@@ -118,7 +130,7 @@ function RenderSession({ sessionId }: { sessionId: string }) {
118130
{session.title || "Untitled"}
119131
</span>
120132
<span className="text-muted-foreground truncate">
121-
{session.enhanced_md ?? session.raw_md}
133+
{enhancedNoteContent ?? session.raw_md}
122134
</span>
123135
</div>
124136
);

apps/desktop/src/components/chat/session.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,19 @@ function useTransport(attachedSessionId?: string) {
186186
const language = main.UI.useValue("ai_language", main.STORE_ID) ?? "en";
187187
const [systemPrompt, setSystemPrompt] = useState<string | undefined>();
188188

189-
const { title, rawMd, enhancedMd, createdAt } = useSession(
189+
const { title, rawMd, createdAt } = useSession(attachedSessionId ?? "");
190+
191+
const enhancedNoteIds = main.UI.useSliceRowIds(
192+
main.INDEXES.enhancedNotesBySession,
190193
attachedSessionId ?? "",
194+
main.STORE_ID,
195+
);
196+
const firstEnhancedNoteId = enhancedNoteIds?.[0];
197+
const enhancedContent = main.UI.useCell(
198+
"enhanced_notes",
199+
firstEnhancedNoteId ?? "",
200+
"content",
201+
main.STORE_ID,
191202
);
192203

193204
const transcriptIds = main.UI.useSliceRowIds(
@@ -253,10 +264,10 @@ function useTransport(attachedSessionId?: string) {
253264
title: (title as string) || null,
254265
date: (createdAt as string) || null,
255266
rawContent: (rawMd as string) || null,
256-
enhancedContent: (enhancedMd as string) || null,
267+
enhancedContent: (enhancedContent as string) || null,
257268
transcript,
258269
};
259-
}, [attachedSessionId, title, rawMd, enhancedMd, createdAt, transcript]);
270+
}, [attachedSessionId, title, rawMd, enhancedContent, createdAt, transcript]);
260271

261272
useEffect(() => {
262273
templateCommands

apps/desktop/src/components/devtool/seed/data/curated.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@
114114
{
115115
"title": "Q4 Strategy Meeting",
116116
"raw_md": "## Q4 Product Strategy\n\nAttendees: John Doe, Sarah Chen, Michael Rodriguez\n\nDiscussed Q4 roadmap, feature priorities, resource allocation, and timeline for product releases...",
117-
"enhanced_md": "# Key Decisions\n- Slack integration prioritized as phase 1 (3 weeks)\n- Performance optimization parallel track (2 weeks profiling + 4-8 weeks optimization)\n- Salesforce integration phase 2 (6 weeks)\n- Resource allocation: 2 senior engineers + 1 junior for integrations\n- Board approval needed by end of week\n\n<p></p>\n\n# Market Insights\n- 2000+ customer survey respondents\n- 78% want better integrations\n- 65% concerned about performance\n- Enterprise pricing model needs adjustment\n\n<p></p>\n\n# Action Items\n- Michael: Technical spec by Nov 5 (responsible)\n- Sarah: Sales constraints analysis (responsible)\n- John: Board coordination for resource approval",
118117
"folder": "Q4 Planning",
119118
"event": "Q4 Product Strategy Planning",
120119
"participants": ["John Doe", "Sarah Chen", "Michael Rodriguez"],
@@ -1466,7 +1465,6 @@
14661465
{
14671466
"title": "TechStart Partnership Call",
14681467
"raw_md": "## Partnership Discussion\n\nAttendees: John Doe, Emma Watson, David Kim\n\nExplored strategic partnership opportunities between Acme Corp and TechStart Labs for API integration and co-marketing...",
1469-
"enhanced_md": "# Strategic Partnership Framework\n\n### Partnership Proposal\n- API integration: TechStart ML capabilities + Acme data processing\n- Revenue model: 30% for TechStart on referrals (70% Acme)\n- Joint go-to-market to mid-market enterprises\n\n<p></p>\n\n### Technical Integration Plan\n- Authentication: OAuth 2.0 (both systems ready)\n- Data sync: Real-time webhooks\n- Rate limits: 1000 req/min initially\n- Security: Mutual TLS for server-to-server\n- Regions: US-primary, EU secondary\n- POC timeline: 3-4 weeks\n\n<p></p>\n\n### Next Steps\n- Legal review: 2 weeks\n- Technical POC: 3-4 weeks (parallel)\n- Pilot program: 6 weeks total",
14701468
"folder": "Projects",
14711469
"event": null,
14721470
"participants": ["John Doe", "Emma Watson", "David Kim"],
@@ -2657,7 +2655,6 @@
26572655
{
26582656
"title": "Quick Check-in",
26592657
"raw_md": "Quick conversation between colleagues.",
2660-
"enhanced_md": "Quick conversation between colleagues.",
26612658
"folder": null,
26622659
"event": null,
26632660
"participants": ["Sarah Chen", "Michael Rodriguez"],

apps/desktop/src/components/devtool/seed/data/loader.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ export const loadCuratedData = (data: CuratedData): Tables<Schemas[0]> => {
140140
user_id: DEFAULT_USER_ID,
141141
title: session.title,
142142
raw_md: JSON.stringify(md2json(session.raw_md)),
143-
enhanced_md: JSON.stringify(md2json(session.enhanced_md)),
144143
created_at: new Date().toISOString(),
145144
event_id: eventId,
146145
folder_id: folderId,

apps/desktop/src/components/devtool/seed/data/schema.gen.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,6 @@
197197
"raw_md": {
198198
"type": "string"
199199
},
200-
"enhanced_md": {
201-
"type": "string"
202-
},
203200
"folder": {
204201
"anyOf": [
205202
{
@@ -296,7 +293,6 @@
296293
"required": [
297294
"title",
298295
"raw_md",
299-
"enhanced_md",
300296
"folder",
301297
"event",
302298
"participants",

apps/desktop/src/components/devtool/seed/data/schema.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ const CuratedEventSchema = z.object({
6868
const CuratedSessionSchema = z.object({
6969
title: z.string(),
7070
raw_md: z.string(),
71-
enhanced_md: z.string(),
7271
folder: z.string().nullable(),
7372
event: z.string().nullable(),
7473
participants: z.array(z.string()),

apps/desktop/src/components/devtool/seed/shared/session.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,13 @@ export const createSession = (
5050
faker.number.int({ min: 2, max: 5 }),
5151
"\n\n",
5252
);
53-
const enhanced_md = generateEnhancedMarkdown();
5453

5554
return {
5655
id: id(),
5756
data: {
5857
user_id: DEFAULT_USER_ID,
5958
title,
6059
raw_md: JSON.stringify(md2json(raw_md)),
61-
enhanced_md: JSON.stringify(md2json(enhanced_md)),
6260
created_at: faker.date.recent({ days: 30 }).toISOString(),
6361
event_id: eventId,
6462
folder_id: folderId,

apps/desktop/src/contexts/search/engine/content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export function createSessionSearchableContent(
55
): string {
66
return mergeContent([
77
extractPlainText(row.raw_md),
8-
extractPlainText(row.enhanced_md),
8+
extractPlainText(row.enhanced_notes_content),
99
flattenTranscript(row.transcript),
1010
]);
1111
}

apps/desktop/src/contexts/search/engine/indexing.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ import {
66
createSessionSearchableContent,
77
} from "./content";
88
import type { Index } from "./types";
9-
import { collectCells, toEpochMs, toTrimmedString } from "./utils";
9+
import {
10+
collectCells,
11+
collectEnhancedNotesContent,
12+
toEpochMs,
13+
toTrimmedString,
14+
} from "./utils";
1015

1116
export function indexSessions(db: Index, store: MainStore): void {
1217
const fields = [
@@ -16,12 +21,12 @@ export function indexSessions(db: Index, store: MainStore): void {
1621
"event_id",
1722
"title",
1823
"raw_md",
19-
"enhanced_md",
2024
"transcript",
2125
];
2226

2327
store.forEachRow("sessions", (rowId: string, _forEachCell) => {
2428
const row = collectCells(store, "sessions", rowId, fields);
29+
row.enhanced_notes_content = collectEnhancedNotesContent(store, rowId);
2530
const title = toTrimmedString(row.title) || "Untitled";
2631

2732
void insert(db, {

apps/desktop/src/contexts/search/engine/listeners.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ import {
88
createSessionSearchableContent,
99
} from "./content";
1010
import type { Index } from "./types";
11-
import { collectCells, toEpochMs, toTrimmedString } from "./utils";
11+
import {
12+
collectCells,
13+
collectEnhancedNotesContent,
14+
toEpochMs,
15+
toTrimmedString,
16+
} from "./utils";
1217

1318
export function createSessionListener(
1419
index: Index,
@@ -25,10 +30,10 @@ export function createSessionListener(
2530
"created_at",
2631
"title",
2732
"raw_md",
28-
"enhanced_md",
2933
"transcript",
3034
];
3135
const row = collectCells(store, "sessions", rowId, fields);
36+
row.enhanced_notes_content = collectEnhancedNotesContent(store, rowId);
3237
const title = toTrimmedString(row.title) || "Untitled";
3338

3439
const data: TypedDocument<Index> = {

0 commit comments

Comments
 (0)