FIX: update draft key for new PM with AI bot (#1123)

* FIX: update draft key for new PM with AI bot

* allow multiple drafts with ai bot

* fix linting
This commit is contained in:
David Battersby 2025-02-13 05:08:31 +04:00 committed by GitHub
parent 77c6543c5d
commit 1bfad17b9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,6 +25,7 @@ export function showShareConversationModal(modal, topicId) {
export function composeAiBotMessage(targetBot, composer) { export function composeAiBotMessage(targetBot, composer) {
const currentUser = composer.currentUser; const currentUser = composer.currentUser;
const draftKey = "new_private_message_ai_" + new Date().getTime();
let botUsername = currentUser.ai_enabled_chat_bots.find( let botUsername = currentUser.ai_enabled_chat_bots.find(
(bot) => bot.model_name === targetBot (bot) => bot.model_name === targetBot
@ -37,10 +38,9 @@ export function composeAiBotMessage(targetBot, composer) {
recipients: botUsername, recipients: botUsername,
topicTitle: i18n("discourse_ai.ai_bot.default_pm_prefix"), topicTitle: i18n("discourse_ai.ai_bot.default_pm_prefix"),
archetypeId: "private_message", archetypeId: "private_message",
draftKey: "private_message_ai", draftKey,
hasGroups: false, hasGroups: false,
warningsDisabled: true, warningsDisabled: true,
skipDraftCheck: true,
}, },
}); });
} }