strapi-plugin-ai-sdk 0.7.1 → 0.7.3
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/dist/_chunks/{App-DcU3uMiY.js → App-CEEsJsKL.js} +20 -6
- package/dist/_chunks/{App-Dwx6guC-.mjs → App-DCV7o6Hc.mjs} +20 -6
- package/dist/_chunks/{index-skxI4tiW.mjs → index-BMrDQVQl.mjs} +1 -1
- package/dist/_chunks/{index-D0dDUeEO.js → index-Cw2aiQ8K.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ const reactRouterDom = require("react-router-dom");
|
|
|
6
6
|
const designSystem = require("@strapi/design-system");
|
|
7
7
|
const react = require("react");
|
|
8
8
|
const styled = require("styled-components");
|
|
9
|
-
const index = require("./index-
|
|
9
|
+
const index = require("./index-Cw2aiQ8K.js");
|
|
10
10
|
const icons = require("@strapi/icons");
|
|
11
11
|
const Markdown = require("react-markdown");
|
|
12
12
|
const remarkGfm = require("remark-gfm");
|
|
@@ -101,11 +101,25 @@ function generateId() {
|
|
|
101
101
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
|
|
102
102
|
}
|
|
103
103
|
function toUIMessages(messages) {
|
|
104
|
-
return messages.map((message) =>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
return messages.map((message) => {
|
|
105
|
+
const parts = [];
|
|
106
|
+
if (message.content) {
|
|
107
|
+
parts.push({ type: "text", text: message.content });
|
|
108
|
+
}
|
|
109
|
+
if (message.toolCalls) {
|
|
110
|
+
for (const tc of message.toolCalls) {
|
|
111
|
+
parts.push({
|
|
112
|
+
type: `tool-${tc.toolName}`,
|
|
113
|
+
toolCallId: tc.toolCallId,
|
|
114
|
+
toolName: tc.toolName,
|
|
115
|
+
state: tc.output !== void 0 ? "output-available" : "input-available",
|
|
116
|
+
input: tc.input,
|
|
117
|
+
...tc.output !== void 0 ? { output: tc.output } : {}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return { id: message.id, role: message.role, parts };
|
|
122
|
+
});
|
|
109
123
|
}
|
|
110
124
|
async function fetchChatStream(messages, enabledToolSources) {
|
|
111
125
|
const token = getToken();
|
|
@@ -4,7 +4,7 @@ import { Link, useNavigate, Routes, Route } from "react-router-dom";
|
|
|
4
4
|
import { Box, Typography, TextInput, Button, Main, SearchForm, Searchbar, Table, Thead, Tr, Th, Tbody, Td, Flex, Pagination, Modal, Field, Textarea, SingleSelect, SingleSelectOption } from "@strapi/design-system";
|
|
5
5
|
import { useState, useEffect, useCallback, useMemo, useRef, forwardRef } from "react";
|
|
6
6
|
import styled from "styled-components";
|
|
7
|
-
import { P as PLUGIN_ID } from "./index-
|
|
7
|
+
import { P as PLUGIN_ID } from "./index-BMrDQVQl.mjs";
|
|
8
8
|
import { Plus, Trash, Sparkle, ArrowLeft, Pencil } from "@strapi/icons";
|
|
9
9
|
import Markdown from "react-markdown";
|
|
10
10
|
import remarkGfm from "remark-gfm";
|
|
@@ -95,11 +95,25 @@ function generateId() {
|
|
|
95
95
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
|
|
96
96
|
}
|
|
97
97
|
function toUIMessages(messages) {
|
|
98
|
-
return messages.map((message) =>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
return messages.map((message) => {
|
|
99
|
+
const parts = [];
|
|
100
|
+
if (message.content) {
|
|
101
|
+
parts.push({ type: "text", text: message.content });
|
|
102
|
+
}
|
|
103
|
+
if (message.toolCalls) {
|
|
104
|
+
for (const tc of message.toolCalls) {
|
|
105
|
+
parts.push({
|
|
106
|
+
type: `tool-${tc.toolName}`,
|
|
107
|
+
toolCallId: tc.toolCallId,
|
|
108
|
+
toolName: tc.toolName,
|
|
109
|
+
state: tc.output !== void 0 ? "output-available" : "input-available",
|
|
110
|
+
input: tc.input,
|
|
111
|
+
...tc.output !== void 0 ? { output: tc.output } : {}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return { id: message.id, role: message.role, parts };
|
|
116
|
+
});
|
|
103
117
|
}
|
|
104
118
|
async function fetchChatStream(messages, enabledToolSources) {
|
|
105
119
|
const token = getToken();
|
|
@@ -37,7 +37,7 @@ const index = {
|
|
|
37
37
|
defaultMessage: PLUGIN_ID
|
|
38
38
|
},
|
|
39
39
|
Component: async () => {
|
|
40
|
-
const { App } = await Promise.resolve().then(() => require("./App-
|
|
40
|
+
const { App } = await Promise.resolve().then(() => require("./App-CEEsJsKL.js"));
|
|
41
41
|
return App;
|
|
42
42
|
}
|
|
43
43
|
});
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
package/package.json
CHANGED