mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-03-09 11:48:47 +00:00
FIX: system persona non English save, missing bot pms
- FIX: only update system attributes when updating system persona - FIX: update participant count by hand so bot messages show in inbox Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
parent
c02794cf2e
commit
77cf9e2cff
@ -20,6 +20,18 @@ const ATTRIBUTES = [
|
|||||||
"max_context_posts",
|
"max_context_posts",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const SYSTEM_ATTRIBUTES = [
|
||||||
|
"allowed_group_ids",
|
||||||
|
"enabled",
|
||||||
|
"system",
|
||||||
|
"priority",
|
||||||
|
"user_id",
|
||||||
|
"mentionable",
|
||||||
|
"default_llm",
|
||||||
|
"user",
|
||||||
|
"max_context_posts",
|
||||||
|
];
|
||||||
|
|
||||||
class CommandOption {
|
class CommandOption {
|
||||||
@tracked value = null;
|
@tracked value = null;
|
||||||
}
|
}
|
||||||
@ -97,7 +109,9 @@ export default class AiPersona extends RestModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateProperties() {
|
updateProperties() {
|
||||||
let attrs = this.getProperties(ATTRIBUTES);
|
let attrs = this.system
|
||||||
|
? this.getProperties(SYSTEM_ATTRIBUTES)
|
||||||
|
: this.getProperties(ATTRIBUTES);
|
||||||
attrs.id = this.id;
|
attrs.id = this.id;
|
||||||
this.populateCommandOptions(attrs);
|
this.populateCommandOptions(attrs);
|
||||||
return attrs;
|
return attrs;
|
||||||
|
@ -273,6 +273,12 @@ module DiscourseAi
|
|||||||
reply_post.post_custom_prompt.update!(custom_prompt: prompt)
|
reply_post.post_custom_prompt.update!(custom_prompt: prompt)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# since we are skipping validations and jobs we
|
||||||
|
# may need to fix participant count
|
||||||
|
if reply_post.topic.private_message? && reply_post.topic.participant_count < 2
|
||||||
|
reply_post.topic.update!(participant_count: 2)
|
||||||
|
end
|
||||||
|
|
||||||
reply_post
|
reply_post
|
||||||
ensure
|
ensure
|
||||||
publish_final_update(reply_post) if stream_reply
|
publish_final_update(reply_post) if stream_reply
|
||||||
|
@ -135,6 +135,8 @@ RSpec.describe DiscourseAi::AiBot::Playground do
|
|||||||
|
|
||||||
last_post.topic.reload
|
last_post.topic.reload
|
||||||
expect(last_post.topic.allowed_users.pluck(:user_id)).to include(persona.user_id)
|
expect(last_post.topic.allowed_users.pluck(:user_id)).to include(persona.user_id)
|
||||||
|
|
||||||
|
expect(last_post.topic.participant_count).to eq(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "picks the correct llm for persona in PMs" do
|
it "picks the correct llm for persona in PMs" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user