@tiledesk/tiledesk-tybot-connector 0.2.149 → 0.2.150
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -117,10 +117,12 @@ class DirAiPrompt {
|
|
|
117
117
|
model: action.model,
|
|
118
118
|
llm_key: key,
|
|
119
119
|
temperature: action.temperature,
|
|
120
|
-
max_tokens: action.max_tokens
|
|
121
|
-
system_context: filled_context,
|
|
120
|
+
max_tokens: action.max_tokens
|
|
122
121
|
}
|
|
123
122
|
|
|
123
|
+
if (action.context) {
|
|
124
|
+
json.system_context = filled_context;
|
|
125
|
+
}
|
|
124
126
|
if (transcript) {
|
|
125
127
|
json.chat_history_dict = await this.transcriptToLLM(transcript);
|
|
126
128
|
}
|
|
@@ -141,12 +143,19 @@ class DirAiPrompt {
|
|
|
141
143
|
HTTPREQUEST, async (err, resbody) => {
|
|
142
144
|
if (err) {
|
|
143
145
|
if (this.log) {
|
|
144
|
-
console.error("(httprequest) DirAiPrompt openai err:", err);
|
|
145
|
-
console.error("(httprequest) DirAiPrompt openai err:", err.detail[0]?.msg);
|
|
146
|
+
console.error("(httprequest) DirAiPrompt openai err:", err.response.data);
|
|
146
147
|
}
|
|
147
148
|
await this.#assignAttributes(action, answer);
|
|
149
|
+
let error;
|
|
150
|
+
if (err.response?.data?.detail[0]) {
|
|
151
|
+
error = err.response.data.detail[0]?.msg;
|
|
152
|
+
} else if (err.response?.data?.detail?.answer) {
|
|
153
|
+
error = err.response.data.detail.answer;
|
|
154
|
+
} else {
|
|
155
|
+
error = JSON.stringify(err.response.data);
|
|
156
|
+
}
|
|
148
157
|
if (falseIntent) {
|
|
149
|
-
await this.chatbot.addParameter("flowError", "AiPrompt Error: " +
|
|
158
|
+
await this.chatbot.addParameter("flowError", "AiPrompt Error: " + error);
|
|
150
159
|
await this.#executeCondition(false, trueIntent, trueIntentAttributes, falseIntent, falseIntentAttributes);
|
|
151
160
|
callback(true);
|
|
152
161
|
return;
|