Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit c49f1df

Browse files
committed
DEV: migrate hyde model to content creator persona
1 parent b46940f commit c49f1df

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# frozen_string_literal: true
2+
class CopyHydeModelToPersona < ActiveRecord::Migration[7.2]
3+
def up
4+
hyde_model =
5+
DB.query_single("SELECT value FROM site_settings WHERE name = 'ai_embeddings_semantic_search_hyde_model'").first
6+
7+
if hyde_model.present? && hyde_model.start_with?("custom:")
8+
# Extract the model ID from the setting value (e.g., "custom:1" -> "1")
9+
model_id = hyde_model.split(":").last
10+
11+
# Update the hyde persona with the extracted model ID
12+
execute(<<~SQL)
13+
UPDATE ai_personas
14+
SET default_llm_id = #{model_id}
15+
WHERE id IN (-32) AND default_llm_id IS NULL
16+
SQL
17+
end
18+
end
19+
20+
def down
21+
raise ActiveRecord::IrreversibleMigration
22+
end
23+
end

0 commit comments

Comments
 (0)