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

Commit 4d7dad1

Browse files
committed
switch to jsonb and make column nullable
1 parent 7263bd1 commit 4d7dad1

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

app/models/ai_persona.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def allowed_seeded_model
393393
# rag_llm_model_id :bigint
394394
# default_llm_id :bigint
395395
# question_consolidator_llm_id :bigint
396-
# response_format :json not null
396+
# response_format :jsonb
397397
#
398398
# Indexes
399399
#
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22
class AddResponseFormatJsonToPersonass < ActiveRecord::Migration[7.2]
33
def change
4-
add_column :ai_personas, :response_format, :json, null: false, default: []
4+
add_column :ai_personas, :response_format, :jsonb
55
end
66
end

lib/personas/bot.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,12 @@ def build_placeholder(summary, details, custom_raw: nil)
311311

312312
def build_json_schema(response_format)
313313
properties =
314-
response_format.reduce({}) do |memo, format|
315-
memo[format[:key].to_sym] = { type: format[:type] }
316-
memo
317-
end
314+
response_format
315+
.to_a
316+
.reduce({}) do |memo, format|
317+
memo[format[:key].to_sym] = { type: format[:type] }
318+
memo
319+
end
318320

319321
{
320322
type: "json_schema",

lib/personas/persona.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def options
154154
end
155155

156156
def response_format
157-
[]
157+
nil
158158
end
159159

160160
def available_tools

0 commit comments

Comments
 (0)