chore: refactoring of Repo.get/get! usages

This commit is contained in:
2026-05-01 17:20:08 +02:00
parent f6425de51d
commit 3505355980
23 changed files with 192 additions and 89 deletions

View File

@@ -53,6 +53,11 @@ defmodule BDS.AI.Chat do
|> Enum.map(&format_conversation/1)
end
@spec get_chat_conversation(String.t()) :: ChatConversation.t() | nil
def get_chat_conversation(conversation_id) when is_binary(conversation_id) do
Repo.get(ChatConversation, conversation_id)
end
@spec available_chat_models(String.t() | nil) :: [map()]
def available_chat_models(current_model \\ nil) do
endpoint_models = configured_chat_models()

View File

@@ -6,6 +6,15 @@ defmodule BDS.AI.ChatConversation do
@primary_key {:id, :string, autogenerate: false}
@type t :: %__MODULE__{
id: String.t(),
title: String.t() | nil,
model: String.t() | nil,
copilot_session_id: String.t() | nil,
created_at: integer() | nil,
updated_at: integer() | nil
}
schema "chat_conversations" do
field :title, :string
field :model, :string