aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-01-12 15:31:30 +0000
committerMohamed Bassem <me@mbassem.com>2025-01-12 15:31:30 +0000
commitb8bd7d7eb27aaaadae728599f64a0874f66196ea (patch)
treed2b9ac7f4324ffe7e1659a7e509635c74c9a1c57 /packages/trpc
parent1ec21b67df64992bf472fc17bc3842369aa313a7 (diff)
downloadkarakeep-b8bd7d7eb27aaaadae728599f64a0874f66196ea.tar.zst
feat: Support customizing the summarization prompt. Fixes #731
Diffstat (limited to 'packages/trpc')
-rw-r--r--packages/trpc/routers/bookmarks.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/trpc/routers/bookmarks.ts b/packages/trpc/routers/bookmarks.ts
index 026bd322..f7f8e6b7 100644
--- a/packages/trpc/routers/bookmarks.ts
+++ b/packages/trpc/routers/bookmarks.ts
@@ -19,6 +19,7 @@ import {
bookmarksInLists,
bookmarkTags,
bookmarkTexts,
+ customPrompts,
rssFeedImportsTable,
tagsOnBookmarks,
} from "@hoarder/db/schema";
@@ -1191,8 +1192,19 @@ Description: ${bookmark.description ?? ""}
Content: ${bookmark.content ?? ""}
`;
+ const prompts = await ctx.db.query.customPrompts.findMany({
+ where: and(
+ eq(customPrompts.userId, ctx.user.id),
+ eq(customPrompts.appliesTo, "summary"),
+ ),
+ columns: {
+ text: true,
+ },
+ });
+
const summaryPrompt = buildSummaryPrompt(
serverConfig.inference.inferredTagLang,
+ prompts.map((p) => p.text),
bookmarkDetails,
serverConfig.inference.contextLength,
);