Просмотр исходного кода

if first args in `puter.chat` is a string, it's the prompt

Nariman Jelveh 9 месяцев назад
Родитель
Сommit
3bface8c66
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      src/puter-js/src/modules/AI.js

+ 6 - 0
src/puter-js/src/modules/AI.js

@@ -144,10 +144,15 @@ class AI{
         }
 
         // ai.chat(prompt)
+        if(typeof args[0] === 'string'){
+            options = { messages: [{ content: args[0] }] };
+        }
+
         // ai.chat(prompt, testMode)
         if (typeof args[0] === 'string' && (!args[1] || typeof args[1] === 'boolean')) {
             options = { messages: [{ content: args[0] }] };
         }
+
         // ai.chat(prompt, imageURL/File)
         // ai.chat(prompt, imageURL/File, testMode)
         else if (typeof args[0] === 'string' && (typeof args[1] === 'string' || args[1] instanceof File)) {
@@ -211,6 +216,7 @@ class AI{
             }
         }
 
+
         // does settings contain `model`? add it to options
         if (settings.model) {
             options.model = settings.model;