feat: more completeness of spec and start at embedding

This commit is contained in:
2026-04-24 07:57:28 +02:00
parent d04117abdc
commit 88f966dae9
10 changed files with 1105 additions and 32 deletions

25
lib/bds/embeddings/key.ex Normal file
View File

@@ -0,0 +1,25 @@
defmodule BDS.Embeddings.Key do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
@primary_key {:label, :integer, autogenerate: false}
@foreign_key_type :string
schema "embedding_keys" do
belongs_to :post, BDS.Posts.Post, type: :string
belongs_to :project, BDS.Projects.Project, type: :string
field :content_hash, :string
field :vector, :string
end
def changeset(key, attrs) do
key
|> cast(attrs, [:label, :post_id, :project_id, :content_hash, :vector])
|> validate_required([:label, :post_id, :project_id, :content_hash, :vector])
|> foreign_key_constraint(:post_id)
|> foreign_key_constraint(:project_id)
end
end