mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-02-09 21:14:43 +00:00
- Validate fields to reduce the chance of breaking features by a misconfigured model. - Fixed a bug where the URL might get deleted during an update. - Display a warning when a model is currently in use.
25 lines
561 B
Ruby
25 lines
561 B
Ruby
# frozen_string_literal: true
|
|
|
|
class LlmModelSerializer < ApplicationSerializer
|
|
root "llm"
|
|
|
|
attributes :id,
|
|
:display_name,
|
|
:name,
|
|
:provider,
|
|
:max_prompt_tokens,
|
|
:tokenizer,
|
|
:api_key,
|
|
:url,
|
|
:enabled_chat_bot,
|
|
:provider_params,
|
|
:vision_enabled,
|
|
:used_by
|
|
|
|
has_one :user, serializer: BasicUserSerializer, embed: :object
|
|
|
|
def used_by
|
|
DiscourseAi::Configuration::LlmValidator.new.modules_using(object)
|
|
end
|
|
end
|