aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/web/components/settings/AISettings.tsx11
-rw-r--r--apps/workers/workers/inference/summarize.ts2
-rw-r--r--apps/workers/workers/inference/tagging.ts6
3 files changed, 9 insertions, 10 deletions
diff --git a/apps/web/components/settings/AISettings.tsx b/apps/web/components/settings/AISettings.tsx
index 6ec71a91..beaa93dc 100644
--- a/apps/web/components/settings/AISettings.tsx
+++ b/apps/web/components/settings/AISettings.tsx
@@ -29,8 +29,8 @@ import { z } from "zod";
import {
buildImagePrompt,
- buildSummaryPrompt,
- buildTextPrompt,
+ buildSummaryPromptUntruncated,
+ buildTextPromptUntruncated,
} from "@karakeep/shared/prompts";
import {
zNewPromptSchema,
@@ -301,6 +301,7 @@ export function PromptDemo() {
const { t } = useTranslation();
const { data: prompts } = api.prompts.list.useQuery();
const clientConfig = useClientConfig();
+
return (
<div className="flex flex-col gap-2">
<div className="mb-4 w-full text-xl font-medium sm:w-1/3">
@@ -308,7 +309,7 @@ export function PromptDemo() {
</div>
<p>{t("settings.ai.text_prompt")}</p>
<code className="whitespace-pre-wrap rounded-md bg-muted p-3 text-sm text-muted-foreground">
- {buildTextPrompt(
+ {buildTextPromptUntruncated(
clientConfig.inference.inferredTagLang,
(prompts ?? [])
.filter(
@@ -316,7 +317,6 @@ export function PromptDemo() {
)
.map((p) => p.text),
"\n<CONTENT_HERE>\n",
- /* context length */ 1024 /* The value here doesn't matter */,
).trim()}
</code>
<p>{t("settings.ai.images_prompt")}</p>
@@ -332,13 +332,12 @@ export function PromptDemo() {
</code>
<p>{t("settings.ai.summarization_prompt")}</p>
<code className="whitespace-pre-wrap rounded-md bg-muted p-3 text-sm text-muted-foreground">
- {buildSummaryPrompt(
+ {buildSummaryPromptUntruncated(
clientConfig.inference.inferredTagLang,
(prompts ?? [])
.filter((p) => p.appliesTo == "summary")
.map((p) => p.text),
"\n<CONTENT_HERE>\n",
- /* context length */ 1024 /* The value here doesn't matter */,
).trim()}
</code>
</div>
diff --git a/apps/workers/workers/inference/summarize.ts b/apps/workers/workers/inference/summarize.ts
index 0fa24869..23636961 100644
--- a/apps/workers/workers/inference/summarize.ts
+++ b/apps/workers/workers/inference/summarize.ts
@@ -105,7 +105,7 @@ URL: ${link.url ?? ""}
},
});
- const summaryPrompt = buildSummaryPrompt(
+ const summaryPrompt = await buildSummaryPrompt(
serverConfig.inference.inferredTagLang,
prompts.map((p) => p.text),
textToSummarize,
diff --git a/apps/workers/workers/inference/tagging.ts b/apps/workers/workers/inference/tagging.ts
index 50a03b00..5a79fd22 100644
--- a/apps/workers/workers/inference/tagging.ts
+++ b/apps/workers/workers/inference/tagging.ts
@@ -94,7 +94,7 @@ async function buildPrompt(
);
return null;
}
- return buildTextPrompt(
+ return await buildTextPrompt(
serverConfig.inference.inferredTagLang,
prompts,
`URL: ${bookmark.link.url}
@@ -106,7 +106,7 @@ Content: ${content ?? ""}`,
}
if (bookmark.text) {
- return buildTextPrompt(
+ return await buildTextPrompt(
serverConfig.inference.inferredTagLang,
prompts,
bookmark.text.text ?? "",
@@ -215,7 +215,7 @@ async function inferTagsFromPDF(
inferenceClient: InferenceClient,
abortSignal: AbortSignal,
) {
- const prompt = buildTextPrompt(
+ const prompt = await buildTextPrompt(
serverConfig.inference.inferredTagLang,
await fetchCustomPrompts(bookmark.userId, "text"),
`Content: ${bookmark.asset.content}`,