diff --git a/client/src/components/GalaxyWizard.vue b/client/src/components/GalaxyWizard.vue index 6d0124fa2d5d..aba928dc7c51 100644 --- a/client/src/components/GalaxyWizard.vue +++ b/client/src/components/GalaxyWizard.vue @@ -3,6 +3,7 @@ import axios from "axios"; import { ref } from "vue"; import Heading from "./Common/Heading.vue"; import LoadingSpan from "./LoadingSpan.vue"; +import { useMarkdown } from "@/composables/markdown"; const props = defineProps({ view: { type: String, @@ -20,6 +21,7 @@ const props = defineProps({ const query = ref(props.query); const queryResponse = ref(""); const busy = ref(false); +const { renderMarkdown } = useMarkdown({ openLinksInNewPage: true }); // on submit, query the server and put response in display box function submitQuery() { busy.value = true; @@ -72,7 +74,7 @@ function submitQuery() { -
{{ queryResponse }}
+
diff --git a/lib/galaxy/managers/configuration.py b/lib/galaxy/managers/configuration.py index d0ccfa8d53c2..88ae96becec1 100644 --- a/lib/galaxy/managers/configuration.py +++ b/lib/galaxy/managers/configuration.py @@ -129,6 +129,7 @@ def _config_is_truthy(item, key, **context): "logo_src_secondary": _use_config, "terms_url": _use_config, "wiki_url": _use_config, + "openai_api_key": _use_config, "screencasts_url": _use_config, "citation_url": _use_config, "citations_export_message_html": _use_config, diff --git a/lib/galaxy/webapps/galaxy/api/chat.py b/lib/galaxy/webapps/galaxy/api/chat.py index 9201fb30b19f..580b20109069 100644 --- a/lib/galaxy/webapps/galaxy/api/chat.py +++ b/lib/galaxy/webapps/galaxy/api/chat.py @@ -26,10 +26,11 @@ router = Router(tags=["chat"]) PROMPT = """ -Adopt the persona of an galaxy project expert who is able to easily explain complex terminal error messages to users. +Adopt the persona of an galaxy project expert who is able to easily explain complex terminal error messages to users, but do so in a dry and serious manner. Focus on providing clear and concise explanations that are easy to understand. - You will be provided with a standard error output and should attempt to explain how this error happened and how to fix it using Galaxy. - If you are unsure about the error, please direct the user https://help.galaxyproject.org/ to ask a human for help. + You will be provided with a standard error output and should attempt to explain how this error happened and how to fix it within Galaxy. + If you are unsure totally sure of how to fix the error, please direct the user https://help.galaxyproject.org/ to ask a human for help. + Please ensure your response is in well formated markdown. """ @router.cbv class ChatAPI: @@ -39,6 +40,8 @@ class ChatAPI: def query(self, query: ChatPayload, trans: ProvidesUserContext = DependsOnTrans) -> str: """We're off to ask the wizard""" + if openai is None: + raise ConfigurationError("OpenAI is not installed. Please install openai to use this feature.") if openai is None or self.config.openai_api_key is None: raise ConfigurationError("OpenAI is not configured for this instance.") else: @@ -67,6 +70,8 @@ def query(self, query: ChatPayload, trans: ProvidesUserContext = DependsOnTrans) model="gpt-4o", messages=messages, ) + print(response) - answer = response["choices"][0]["message"]["content"] + answer = response.choices[0].message.content + print(answer) return answer \ No newline at end of file