Files
libredesk/internal/tag/queries.sql
T
Abhinav Raut 000d789ed8 shortlist tags with embeddings before asking the LLM to suggest them
Tag suggestion used to send the first 300 tags to the model, so anything past
that was invisible. Tags are now embedded into the same index as the knowledge
base, and only the tags most similar to the conversation get sent. The reconcile
loop embeds new and renamed tags and drops vectors for deleted ones, and a
provider change purges them so they are rebuilt with the new model.
2026-07-30 23:09:23 +05:30

33 lines
359 B
SQL

-- name: get-all-tags
select
id,
created_at,
updated_at,
name
from
tags
order by
name;
-- name: insert-tag
INSERT into
tags (name)
values
($1)
RETURNING *;
-- name: delete-tag
DELETE from
tags
where
id = $1;
-- name: update-tag
UPDATE
tags
set
name = $2,
updated_at = now()
where
id = $1
RETURNING *;