aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-04-02 11:08:53 +0100
committerMohamedBassem <me@mbassem.com>2024-04-02 11:08:53 +0100
commitc73dde43cc816b8bf8eee74051d4fdac402cc710 (patch)
tree6c22b9e7d5802f27567d90216ade8512979ee7e4 /apps
parentd9f0a431d5fd333e8fdaa2375281d079aafadf1c (diff)
downloadkarakeep-c73dde43cc816b8bf8eee74051d4fdac402cc710.tar.zst
feat(workers): Allow configuring the language in which the tags are generated. Fixes #68
Diffstat (limited to 'apps')
-rw-r--r--apps/workers/openaiWorker.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/workers/openaiWorker.ts b/apps/workers/openaiWorker.ts
index bb8015a5..c7b519e2 100644
--- a/apps/workers/openaiWorker.ts
+++ b/apps/workers/openaiWorker.ts
@@ -7,6 +7,7 @@ import type { ZOpenAIRequest } from "@hoarder/shared/queues";
import { db } from "@hoarder/db";
import { bookmarks, bookmarkTags, tagsOnBookmarks } from "@hoarder/db/schema";
import { readAsset } from "@hoarder/shared/assetdb";
+import serverConfig from "@hoarder/shared/config";
import logger from "@hoarder/shared/logger";
import {
OpenAIQueue,
@@ -73,15 +74,14 @@ export class OpenAiWorker {
const IMAGE_PROMPT_BASE = `
I'm building a read-it-later app and I need your help with automatic tagging.
Please analyze the attached image and suggest relevant tags that describe its key themes, topics, and main ideas.
-Aim for a variety of tags, including broad categories, specific keywords, and potential sub-genres. If it's a famous website
-you may also include a tag for the website. If the tag is not generic enough, don't include it. Aim for 10-15 tags.
-If there are no good tags, don't emit any. You must respond in valid JSON with the key "tags" and the value is list of tags.
-Don't wrap the response in a markdown code.`;
+Aim for a variety of tags, including broad categories, specific keywords, and potential sub-genres. The tags language must be ${serverConfig.inference.inferredTagLang}.
+If the tag is not generic enough, don't include it. Aim for 10-15 tags. If there are no good tags, don't emit any. You must respond in valid JSON
+with the key "tags" and the value is list of tags. Don't wrap the response in a markdown code.`;
const TEXT_PROMPT_BASE = `
I'm building a read-it-later app and I need your help with automatic tagging.
Please analyze the text after the sentence "CONTENT START HERE:" and suggest relevant tags that describe its key themes, topics, and main ideas.
-Aim for a variety of tags, including broad categories, specific keywords, and potential sub-genres. If it's a famous website
+Aim for a variety of tags, including broad categories, specific keywords, and potential sub-genres. The tags language must be ${serverConfig.inference.inferredTagLang}. If it's a famous website
you may also include a tag for the website. If the tag is not generic enough, don't include it. Aim for 3-5 tags. If there are no good tags, don't emit any.
The content can include text for cookie consent and privacy policy, ignore those while tagging.
You must respond in JSON with the key "tags" and the value is list of tags.