Duo Chat: Output non-recoverable errors
What does this MR do and why?
The MR introduces the output of the potential non-recoverable errors in Duo Chat.
Screenshots or screen recordings
When sending the same /clean
prompt into chat.
Before | After |
---|---|
How to set up and validate locally
- Set up GitLab Duo Chat. Mainly, you're interested in running the automatic script
- Apply patch which guarantees an error when sending
/clean
:
diff --git a/ee/app/services/llm/chat_service.rb b/ee/app/services/llm/chat_service.rb
index 8a2030952e94..bc93cce9c4ee 100644
--- a/ee/app/services/llm/chat_service.rb
+++ b/ee/app/services/llm/chat_service.rb
@@ -9,7 +9,11 @@ def ai_action
end
def perform
- prompt_message.save!
+ if prompt_message.chat_cleaned?
+ prompt_message.clean!
+ else
+ prompt_message.save!
+ end
GraphqlTriggers.ai_completion_response(prompt_message)
schedule_completion_worker unless prompt_message.conversation_reset?
end
diff --git a/ee/lib/gitlab/llm/chat_message.rb b/ee/lib/gitlab/llm/chat_message.rb
index 787487f7518e..7769a0117a64 100644
--- a/ee/lib/gitlab/llm/chat_message.rb
+++ b/ee/lib/gitlab/llm/chat_message.rb
@@ -4,14 +4,23 @@ module Gitlab
module Llm
class ChatMessage < AiMessage
RESET_MESSAGE = '/reset'
+ CLEAN_MESSAGE = '/clean'
def save!
ChatStorage.new(user).add(self)
end
+ def clean!
+ raise "500 Internal Server Error"
+ end
+
def conversation_reset?
content == RESET_MESSAGE
end
+
+ def chat_cleaned?
+ content == CLEAN_MESSAGE
+ end
end
end
end
- Start the chat from the left-hand navigation panel in "Help -> GitLab Duo Chat"
- Send
/clean
message in the chat
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Denys Mishunov