changeset 1:db316ead4bda draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 13c168a7d6a2d5050c04253754fb86321ad57d54
author bgruening
date Wed, 14 Aug 2024 11:33:36 +0000
parents b5971fa941dd
children 329bdb05dd90
files chatgpt.py chatgpt.xml
diffstat 2 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/chatgpt.py	Tue Aug 13 14:25:10 2024 +0000
+++ b/chatgpt.py	Wed Aug 14 11:33:36 2024 +0000
@@ -9,7 +9,8 @@
 with open(sys.argv[4], "r") as f:
     openai_api_key = f.read().strip()
 if not openai_api_key:
-    raise Exception("OpenAI API key is not provided in user preferences!")
+    print("OpenAI API key is not provided in user preferences!")
+    sys.exit(1)
 
 client = OpenAI(api_key=openai_api_key)
 
--- a/chatgpt.xml	Tue Aug 13 14:25:10 2024 +0000
+++ b/chatgpt.xml	Wed Aug 14 11:33:36 2024 +0000
@@ -32,8 +32,10 @@
         ]]></configfile>
     </configfiles>
     <inputs>
-        <param name="context" type="data" multiple="true" optional="false" format="doc,docx,html,json,pdf,txt,jpg,jpeg,png,webp,gif" label="Context" max="500"/>
-        <param name="question" type="text" optional="false" label="Question" help="Question about the text provided" area="true"/>
+        <param name="context" type="data" multiple="true" optional="false" format="doc,docx,html,json,pdf,txt,jpg,jpeg,png,webp,gif" label="Context" max="500" help="This data will be uploaded to OpenAI's servers for processing."/>
+        <param name="question" type="text" optional="false" label="Question" help="Question about the text provided" area="true">
+            <validator type="empty_field"/>
+        </param>
         <param name="model" type="select" optional="false" label="Model" help="Select the model you want to use">
             <option value="gpt-4o-mini" selected="true">Affordable and intelligent small model for fast, lightweight tasks (gpt-4o-mini)</option>
             <option value="gpt-4o">High-intelligence flagship model for complex, multi-step tasks (gpt-4o)</option>
@@ -50,9 +52,9 @@
             <param name="context" value="chatgpt_test.txt" ftype="txt"/>
             <param name="question" value="What is this?"/>
             <param name="model" value="gpt-4o-mini"/>
-            <assert_stderr>
-                <has_text text="Exception: OpenAI API key is not provided in user preferences!"/>
-            </assert_stderr>
+            <assert_stdout>
+                <has_text text="OpenAI API key is not provided in user preferences!"/>
+            </assert_stdout>
         </test>
     </tests>
     <help><![CDATA[