discourse-ai/db/migrate/20241014010245_ai_persona_chat_topic_refactor.rb
Sam bdf3b6268b
FEATURE: smarter persona tethering (#832)
Splits persona permissions so you can allow a persona on:

- chat dms
- personal messages
- topic mentions
- chat channels

(any combination is allowed)

Previously we did not have this flexibility.

Additionally, adds the ability to "tether" a language model to a persona so it will always be used by the persona. This allows people to use a cheaper language model for one group of people and more expensive one for other people
2024-10-16 07:20:31 +11:00

24 lines
872 B
Ruby

# frozen_string_literal: true
class AiPersonaChatTopicRefactor < ActiveRecord::Migration[7.1]
def change
add_column :ai_personas, :allow_chat_channel_mentions, :boolean, default: false, null: false
add_column :ai_personas, :allow_chat_direct_messages, :boolean, default: false, null: false
add_column :ai_personas, :allow_topic_mentions, :boolean, default: false, null: false
add_column :ai_personas, :allow_personal_messages, :boolean, default: true, null: false
add_column :ai_personas, :force_default_llm, :boolean, default: false, null: false
execute <<~SQL
UPDATE ai_personas
SET allow_chat_channel_mentions = mentionable, allow_chat_direct_messages = true
WHERE allow_chat = true
SQL
execute <<~SQL
UPDATE ai_personas
SET allow_topic_mentions = true
WHERE mentionable = true
SQL
end
end