mirror of
https://github.com/linkwarden/linkwarden.git
synced 2026-03-03 02:27:00 +00:00
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@linkwarden/web",
|
||||
"version": "v2.13.4",
|
||||
"version": "v2.13.5",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/linkwarden/linkwarden.git",
|
||||
"author": "Daniel31X13 <daniel31x13@gmail.com>",
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
predefinedTagsPrompt,
|
||||
} from "./prompts";
|
||||
import { prisma } from "@linkwarden/prisma";
|
||||
import { generateObject } from "ai";
|
||||
import { generateText } from "ai";
|
||||
import { LanguageModelV2 } from "@ai-sdk/provider";
|
||||
import {
|
||||
createOpenAICompatible,
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
} from "@ai-sdk/openai-compatible";
|
||||
import { perplexity } from "@ai-sdk/perplexity";
|
||||
import { azure } from "@ai-sdk/azure";
|
||||
import { z } from "zod";
|
||||
import { anthropic } from "@ai-sdk/anthropic";
|
||||
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
||||
import { createOllama } from "ollama-ai-provider-v2";
|
||||
@@ -127,15 +126,13 @@ export default async function autoTagLink(
|
||||
return console.log("No predefined tags to auto tag for link: ", link.url);
|
||||
}
|
||||
|
||||
const { object } = await generateObject({
|
||||
const { text } = await generateText({
|
||||
model: getAIModel(),
|
||||
prompt: prompt,
|
||||
output: "array",
|
||||
schema: z.string(),
|
||||
});
|
||||
|
||||
try {
|
||||
let tags = object;
|
||||
let tags: string[] = JSON.parse(text);
|
||||
|
||||
if (!tags || tags.length === 0) {
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const generateTagsPrompt = (text: string) => `
|
||||
You are a Bookmark Manager that should extract relevant tags from the following text, here are the rules:
|
||||
- The final output should be only an array of tags (like ["tag1", "tag2", "...").
|
||||
- The final output should be only an array of tags (like ["tag1", "tag2", "..."]).
|
||||
- The tags should be in the language of the text.
|
||||
- The maximum number of tags is 5.
|
||||
- Each tag should be maximum one to two words.
|
||||
@@ -15,7 +15,7 @@ export const predefinedTagsPrompt = (text: string, tags: string[]) => `
|
||||
You are a Bookmark Manager that should match the following text with predefined tags.
|
||||
Predefined tags: ${tags.join(", ")}.
|
||||
Here are the rules:
|
||||
- The final output should be only an array of tags (like ["tag1", "tag2", "...").
|
||||
- The final output should be only an array of tags (like ["tag1", "tag2", "..."]).
|
||||
- The tags should be in the language of the text.
|
||||
- The maximum number of tags is 5.
|
||||
- Each tag should be maximum one to two words.
|
||||
@@ -30,7 +30,7 @@ export const existingTagsPrompt = (text: string, tags: string[]) => `
|
||||
You are a Bookmark Manager that should match the following text with existing tags.
|
||||
The existing tags are sorted from most used to least used: ${tags.join(", ")}.
|
||||
Here are the rules:
|
||||
- The final output should be only an array of tags (like ["tag1", "tag2", "...").
|
||||
- The final output should be only an array of tags (like ["tag1", "tag2", "..."]).
|
||||
- The tags should be in the language of the text.
|
||||
- The maximum number of tags is 5.
|
||||
- Each tag should be maximum one to two words.
|
||||
|
||||
Reference in New Issue
Block a user