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

This commit is contained in:
Nariman Jelveh
2024-08-21 20:38:03 -07:00
parent dadaf5e8b1
commit 3bface8c66
+6
View File
@@ -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;