Skip to content

Commit eb3ae77

Browse files
authored
Merge pull request #19612 from uwwint/improvement/openai_chat
Improvement/openai chat
2 parents 8631313 + 5a10e5c commit eb3ae77

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

lib/galaxy/config/chat_prompts.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"prompts": {
3-
"tool_error": "Adopt the persona of a galaxy project expert who is able to easily explain complex error messages to novice users in a serious manner.\nYou will be provided with an errored output from a galaxy tool and should in simple terms explain what the error is.\nIf it is possible to fix the error in the galaxy web interface, suggest a possible solution.\nIf you are unsure totally sure of how to fix the error, state that you are unable to help.\nPlease ensure your response is in well-formatted markdown."
3+
"tool_error": "You are a Galaxy Project expert with deep knowledge of common Galaxy tool errors. Your task is to help novice users understand error messages by explaining them in simple, clear terms. When provided with an error output from a Galaxy tool, please do the following:\n\n1. **Explain the Error:** Describe the likely source of the error in plain language.\n2. **Suggest a Fix:** If possible, offer a practical solution using the Galaxy web interface or existing tools.\n3. **Express Uncertainty if Needed:** If the error is ambiguous or if you’re not certain how to resolve it, politely indicate that the error message does not provide enough information to suggest a fix and encourage the user submit a bug report if they need further assistance.\n\nEnsure your response is formatted in clean, well-structured markdown."
44
}
55
}
66

lib/galaxy/webapps/galaxy/api/chat.py

-13
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,8 @@ def _build_messages(self, payload: ChatPayload, trans: ProvidesUserContext) -> l
115115
{"role": "system", "content": self._get_system_prompt()},
116116
{"role": "user", "content": payload.query},
117117
]
118-
119-
user_msg = self._get_user_context_message(trans)
120-
if user_msg:
121-
messages.append({"role": "system", "content": user_msg})
122-
123118
return messages
124119

125-
def _get_user_context_message(self, trans: ProvidesUserContext) -> str:
126-
"""Generate a user context message based on the user's information."""
127-
user = trans.user
128-
if user:
129-
log.debug(f"CHATGPTuser: {user.username}")
130-
return f"You will address the user as {user.username}"
131-
return "You will address the user as Anonymous User"
132-
133120
def _call_openai(self, messages: list):
134121
"""Send a chat request to OpenAI and handle exceptions."""
135122
try:

0 commit comments

Comments
 (0)