neoagent 2.1.18-beta.48 → 2.1.18-beta.49
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/package.json
CHANGED
|
@@ -37,6 +37,6 @@ _flutter.buildConfig = {"engineRevision":"425cfb54d01a9472b3e81d9e76fd63a4a44cfb
|
|
|
37
37
|
|
|
38
38
|
_flutter.loader.load({
|
|
39
39
|
serviceWorkerSettings: {
|
|
40
|
-
serviceWorkerVersion: "
|
|
40
|
+
serviceWorkerVersion: "306251431" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
|
|
41
41
|
}
|
|
42
42
|
});
|
|
@@ -38,6 +38,14 @@ class AnthropicProvider extends BaseProvider {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
normalizeContentBlocks(blocks = []) {
|
|
41
|
+
if (!Array.isArray(blocks)) {
|
|
42
|
+
if (blocks && typeof blocks === 'object' && blocks.type) {
|
|
43
|
+
blocks = [blocks];
|
|
44
|
+
} else {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
41
49
|
const normalized = [];
|
|
42
50
|
|
|
43
51
|
for (const block of blocks) {
|
|
@@ -149,12 +157,15 @@ class AnthropicProvider extends BaseProvider {
|
|
|
149
157
|
if (tools.length > 0) params.tools = this.formatTools(tools);
|
|
150
158
|
|
|
151
159
|
const response = await this.client.messages.create(params);
|
|
160
|
+
const responseBlocks = Array.isArray(response?.content)
|
|
161
|
+
? response.content
|
|
162
|
+
: (response?.content && typeof response.content === 'object' ? [response.content] : []);
|
|
152
163
|
|
|
153
164
|
let content = '';
|
|
154
165
|
const toolCalls = [];
|
|
155
|
-
const providerContentBlocks = this.normalizeContentBlocks(
|
|
166
|
+
const providerContentBlocks = this.normalizeContentBlocks(responseBlocks);
|
|
156
167
|
|
|
157
|
-
for (const block of
|
|
168
|
+
for (const block of responseBlocks) {
|
|
158
169
|
if (block.type === 'text') {
|
|
159
170
|
content += block.text;
|
|
160
171
|
} else if (block.type === 'tool_use') {
|