aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc/models
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2026-02-09 00:09:10 +0000
committerGitHub <noreply@github.com>2026-02-09 00:09:10 +0000
commit4186c4c64c68892248ce8671d9b8e67fc7f884a0 (patch)
tree91bbbfc0bb47a966b9e340fdbe2a61b2e10ebd19 /packages/trpc/models
parent77b186c3a599297da0cf19e923c66607ad7d74e7 (diff)
downloadkarakeep-4186c4c64c68892248ce8671d9b8e67fc7f884a0.tar.zst
feat(ai): Support restricting AI tags to a subset of existing tags (#2444)
* feat(ai): Support restricting AI tags to a subset of existing tags Co-authored-by: Claude <noreply@anthropic.com>
Diffstat (limited to 'packages/trpc/models')
-rw-r--r--packages/trpc/models/tags.ts4
-rw-r--r--packages/trpc/models/users.ts3
2 files changed, 7 insertions, 0 deletions
diff --git a/packages/trpc/models/tags.ts b/packages/trpc/models/tags.ts
index 55532077..1d8f90b9 100644
--- a/packages/trpc/models/tags.ts
+++ b/packages/trpc/models/tags.ts
@@ -85,6 +85,7 @@ export class Tag {
ctx: AuthedContext,
opts: {
nameContains?: string;
+ ids?: string[];
attachedBy?: "ai" | "human" | "none";
sortBy?: "name" | "usage" | "relevance";
pagination?: {
@@ -119,6 +120,9 @@ export class Tag {
opts.nameContains
? like(bookmarkTags.name, `%${opts.nameContains}%`)
: undefined,
+ opts.ids && opts.ids.length > 0
+ ? inArray(bookmarkTags.id, opts.ids)
+ : undefined,
),
)
.groupBy(bookmarkTags.id, bookmarkTags.name)
diff --git a/packages/trpc/models/users.ts b/packages/trpc/models/users.ts
index 671f7d74..3340956a 100644
--- a/packages/trpc/models/users.ts
+++ b/packages/trpc/models/users.ts
@@ -447,6 +447,7 @@ export class User {
autoTaggingEnabled: true,
autoSummarizationEnabled: true,
tagStyle: true,
+ curatedTagIds: true,
inferredTagLang: true,
},
});
@@ -471,6 +472,7 @@ export class User {
autoTaggingEnabled: settings.autoTaggingEnabled,
autoSummarizationEnabled: settings.autoSummarizationEnabled,
tagStyle: settings.tagStyle ?? "as-generated",
+ curatedTagIds: settings.curatedTagIds ?? null,
inferredTagLang: settings.inferredTagLang,
};
}
@@ -500,6 +502,7 @@ export class User {
autoTaggingEnabled: input.autoTaggingEnabled,
autoSummarizationEnabled: input.autoSummarizationEnabled,
tagStyle: input.tagStyle,
+ curatedTagIds: input.curatedTagIds,
inferredTagLang: input.inferredTagLang,
})
.where(eq(users.id, this.user.id));