This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +27
-12
lines changed Expand file tree Collapse file tree 3 files changed +27
-12
lines changed Original file line number Diff line number Diff line change @@ -129,8 +129,6 @@ def class_instance
129129 tool_details
130130 ]
131131
132- persona_class = DiscourseAi ::AiBot ::Personas ::Persona . system_personas_by_id [ self . id ]
133-
134132 instance_attributes = { }
135133 attributes . each do |attr |
136134 value = self . read_attribute ( attr )
@@ -139,14 +137,6 @@ def class_instance
139137
140138 instance_attributes [ :username ] = user &.username_lower
141139
142- if persona_class
143- instance_attributes . each do |key , value |
144- # description/name are localized
145- persona_class . define_singleton_method ( key ) { value } if key != :description && key != :name
146- end
147- return persona_class
148- end
149-
150140 options = { }
151141 force_tool_use = [ ]
152142
@@ -179,6 +169,16 @@ def class_instance
179169 klass
180170 end
181171
172+ persona_class = DiscourseAi ::AiBot ::Personas ::Persona . system_personas_by_id [ self . id ]
173+ if persona_class
174+ instance_attributes . each do |key , value |
175+ # description/name are localized
176+ persona_class . define_singleton_method ( key ) { value } if key != :description && key != :name
177+ end
178+ persona_class . define_method ( :options ) { options }
179+ return persona_class
180+ end
181+
182182 ai_persona_id = self . id
183183
184184 Class . new ( DiscourseAi ::AiBot ::Personas ::Persona ) do
Original file line number Diff line number Diff line change 306306 description : " Language model to use for artifact edits"
307307 update_algorithm :
308308 name : " Update Algorithm"
309- description : " Algorithm used for artifact updates (full vs diff) "
309+ description : " Ask LLM to fully replace, or use diff to update "
310310 google :
311311 base_query :
312312 name : " Base Search Query"
Original file line number Diff line number Diff line change @@ -65,9 +65,24 @@ def invoke
6565 return error_response ( "Attempting to update an artifact you are not allowed to" )
6666 end
6767
68+ llm =
69+ (
70+ options [ :editor_llm ] . present? &&
71+ LlmModel . find_by ( id : options [ :editor_llm ] . to_i ) &.to_llm
72+ ) || self . llm
73+
74+ strategy =
75+ (
76+ if options [ :update_algorithm ] == "diff"
77+ ArtifactUpdateStrategies ::Diff
78+ else
79+ ArtifactUpdateStrategies ::Full
80+ end
81+ )
82+
6883 begin
6984 new_version =
70- ArtifactUpdateStrategies :: Full . new (
85+ strategy . new (
7186 llm : llm ,
7287 post : post ,
7388 user : post . user ,
You can’t perform that action at this time.
0 commit comments