@malette/agent-sdk 0.1.3-beta.7 → 0.1.3-beta.8
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/index.js +25 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -890,7 +890,7 @@ function getCacheKey(text3) {
|
|
|
890
890
|
return text3.slice(0, 200);
|
|
891
891
|
}
|
|
892
892
|
async function submitGenerateTask(text3) {
|
|
893
|
-
const response = await
|
|
893
|
+
const response = await fetcher("/api/v1/ai/design/generate", {
|
|
894
894
|
method: "POST",
|
|
895
895
|
headers: { "content-type": "application/json" },
|
|
896
896
|
credentials: "include",
|
|
@@ -904,11 +904,10 @@ async function submitGenerateTask(text3) {
|
|
|
904
904
|
version: "0.1.0"
|
|
905
905
|
})
|
|
906
906
|
});
|
|
907
|
-
if (!response.
|
|
907
|
+
if (!response.success) {
|
|
908
908
|
throw new Error(`TTS generate request failed: ${response.status}`);
|
|
909
909
|
}
|
|
910
|
-
const
|
|
911
|
-
const data = result.data ?? result;
|
|
910
|
+
const data = response.data;
|
|
912
911
|
console.log("[TTS] Generate task submitted:", data);
|
|
913
912
|
const publicId = data?.publicId || data?.recordVO?.publicId || (typeof data === "string" ? data : null);
|
|
914
913
|
if (!publicId) {
|
|
@@ -1607,6 +1606,7 @@ var useAgentStore = zustand.create()(
|
|
|
1607
1606
|
...state.artifacts,
|
|
1608
1607
|
[artifactId]: {
|
|
1609
1608
|
...existing,
|
|
1609
|
+
source,
|
|
1610
1610
|
currentContent: content,
|
|
1611
1611
|
version: existing.version + 1,
|
|
1612
1612
|
gmtModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -13362,8 +13362,7 @@ var ToolResultRenderer = React16.memo(function ToolResultRenderer2({
|
|
|
13362
13362
|
if (!toolCallData) return void 0;
|
|
13363
13363
|
const resultAny = toolCallData.result;
|
|
13364
13364
|
const metadata = {};
|
|
13365
|
-
|
|
13366
|
-
if (resultAny?.relation?.toolName) metadata.toolName = resultAny.relation.toolName;
|
|
13365
|
+
metadata.toolName = toolCallData?.displayName || toolCallData?.name || "\u5DE5\u5177\u8C03\u7528";
|
|
13367
13366
|
if (toolCallData.arguments) metadata.generationParams = toolCallData.arguments;
|
|
13368
13367
|
if (resultAny?.relation) metadata.relation = resultAny.relation;
|
|
13369
13368
|
if (resultAny?.taskId) metadata.taskId = resultAny.taskId;
|
|
@@ -13393,8 +13392,7 @@ var ToolResultRenderer = React16.memo(function ToolResultRenderer2({
|
|
|
13393
13392
|
{
|
|
13394
13393
|
onClick: (e) => {
|
|
13395
13394
|
e.stopPropagation();
|
|
13396
|
-
const
|
|
13397
|
-
const displayName = resultAny?.relation?.toolName || toolCallData?.name || "\u89C6\u9891\u751F\u6210";
|
|
13395
|
+
const displayName = toolCallData?.displayName || "\u89C6\u9891\u751F\u6210";
|
|
13398
13396
|
onOpenArtifact({
|
|
13399
13397
|
type: "video",
|
|
13400
13398
|
title: `${displayName} #${i + 1}`,
|
|
@@ -13448,8 +13446,7 @@ var ToolResultRenderer = React16.memo(function ToolResultRenderer2({
|
|
|
13448
13446
|
{
|
|
13449
13447
|
onClick: (e) => {
|
|
13450
13448
|
e.stopPropagation();
|
|
13451
|
-
const
|
|
13452
|
-
const displayName = resultAny?.relation?.toolName || toolCallData?.name || "\u56FE\u7247\u751F\u6210";
|
|
13449
|
+
const displayName = toolCallData?.displayName || "\u56FE\u7247\u751F\u6210";
|
|
13453
13450
|
onOpenArtifact({
|
|
13454
13451
|
type: "image",
|
|
13455
13452
|
title: `${displayName} #${i + 1}`,
|
|
@@ -13618,7 +13615,10 @@ var ToolCallCard = React16.memo(function ToolCallCard2({
|
|
|
13618
13615
|
result: toolCall.result,
|
|
13619
13616
|
mediaUrls,
|
|
13620
13617
|
config,
|
|
13621
|
-
toolCallData:
|
|
13618
|
+
toolCallData: {
|
|
13619
|
+
...toolCall,
|
|
13620
|
+
displayName: toolDisplayName
|
|
13621
|
+
},
|
|
13622
13622
|
defaultExpanded: false,
|
|
13623
13623
|
onOpenArtifact
|
|
13624
13624
|
}
|
|
@@ -23655,6 +23655,7 @@ function Sidebar({
|
|
|
23655
23655
|
onNew,
|
|
23656
23656
|
agentName,
|
|
23657
23657
|
agentType,
|
|
23658
|
+
agentIcon,
|
|
23658
23659
|
collapsed,
|
|
23659
23660
|
onToggle
|
|
23660
23661
|
}) {
|
|
@@ -23678,7 +23679,7 @@ function Sidebar({
|
|
|
23678
23679
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3 border-b border-zinc-800/50", children: [
|
|
23679
23680
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
|
|
23680
23681
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
23681
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-7 h-7 rounded-lg bg-[#d8ff00]/10 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bot, { size: 14, className: "text-[#d8ff00]" }) }),
|
|
23682
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-7 h-7 rounded-lg bg-[#d8ff00]/10 flex items-center justify-center flex-shrink-0", children: agentIcon ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: getImageUrl(agentIcon), alt: "Agent Icon", className: "w-7 h-7 rounded-lg" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bot, { size: 14, className: "text-[#d8ff00]" }) }),
|
|
23682
23683
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-white truncate", children: agentName || "Agent" })
|
|
23683
23684
|
] }),
|
|
23684
23685
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-0.5", children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: onToggle, className: "p-1.5 text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800 rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftClose, { size: 14 }) }) })
|
|
@@ -24350,7 +24351,11 @@ function useArtifactPanel({ currentSessionId }) {
|
|
|
24350
24351
|
return;
|
|
24351
24352
|
}
|
|
24352
24353
|
const existingArtifact = Object.values(artifacts).find(
|
|
24353
|
-
(a) =>
|
|
24354
|
+
(a) => {
|
|
24355
|
+
const sameContent = a.currentContent === data.content && a.type === data.type;
|
|
24356
|
+
const sameId = a?.metadata?.workId === data.metadata?.workId;
|
|
24357
|
+
return sameContent || sameId;
|
|
24358
|
+
}
|
|
24354
24359
|
);
|
|
24355
24360
|
if (existingArtifact) {
|
|
24356
24361
|
setActiveArtifact(existingArtifact.id);
|
|
@@ -25198,6 +25203,7 @@ var AgentChat = React16__namespace.default.forwardRef(({
|
|
|
25198
25203
|
tools: _tools,
|
|
25199
25204
|
setTools,
|
|
25200
25205
|
setSkills,
|
|
25206
|
+
mainAgentIcon,
|
|
25201
25207
|
setShowItemTime,
|
|
25202
25208
|
setSubAgentConfigs,
|
|
25203
25209
|
setMainAgentPublicId,
|
|
@@ -25490,6 +25496,7 @@ var AgentChat = React16__namespace.default.forwardRef(({
|
|
|
25490
25496
|
onNew: handleNew,
|
|
25491
25497
|
agentName,
|
|
25492
25498
|
agentType,
|
|
25499
|
+
agentIcon: mainAgentIcon,
|
|
25493
25500
|
collapsed,
|
|
25494
25501
|
onToggle: () => setCollapsed(!collapsed)
|
|
25495
25502
|
}
|
|
@@ -25538,14 +25545,14 @@ var AgentChat = React16__namespace.default.forwardRef(({
|
|
|
25538
25545
|
),
|
|
25539
25546
|
style: currentArtifact && !isArtifactFullscreen ? { width: `${100 - artifactPanelWidth}%` } : void 0,
|
|
25540
25547
|
children: [
|
|
25541
|
-
showHeader
|
|
25548
|
+
showHeader ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 h-12 px-3 border-b border-zinc-800/50 bg-zinc-950/80 backdrop-blur-sm flex-shrink-0", children: [
|
|
25542
25549
|
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => setMobileOpen(true), className: "lg:hidden p-1.5 text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800 rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeft, { size: 18 }) }),
|
|
25543
25550
|
onNavigateBack && /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: onNavigateBack, className: "p-1.5 text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800 rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, { size: 18 }) }),
|
|
25544
25551
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-px bg-zinc-800 mx-1" }),
|
|
25545
25552
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-zinc-300 font-medium", children: agentName || "Agent" }),
|
|
25546
25553
|
agentType && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-zinc-600 bg-zinc-800/50 px-1.5 py-0.5 rounded", children: agentType === "BUILTIN" ? "\u5185\u7F6E" : agentType === "EXTERNAL" ? "\u5916\u90E8" : "\u591AAgent" }),
|
|
25547
25554
|
onNavigateToSettings && /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: onNavigateToSettings, className: "ml-auto p-1.5 text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800 rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { size: 18 }) })
|
|
25548
|
-
] }),
|
|
25555
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => setMobileOpen(true), className: "lg:hidden p-1.5 text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800 rounded-lg w-8", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeft, { size: 18 }) }),
|
|
25549
25556
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25550
25557
|
ChatWindow_default,
|
|
25551
25558
|
{
|
|
@@ -25655,21 +25662,18 @@ var AgentChat = React16__namespace.default.forwardRef(({
|
|
|
25655
25662
|
}
|
|
25656
25663
|
},
|
|
25657
25664
|
onReorderArtifacts: (fromIndex, toIndex) => {
|
|
25658
|
-
|
|
25659
|
-
const [moved] = newOrder.splice(fromIndex, 1);
|
|
25660
|
-
newOrder.splice(toIndex, 0, moved);
|
|
25661
|
-
reorderArtifacts(newOrder);
|
|
25665
|
+
reorderArtifacts(fromIndex, toIndex);
|
|
25662
25666
|
},
|
|
25663
25667
|
onContentChange: (content) => {
|
|
25664
25668
|
if (activeArtifact) {
|
|
25665
|
-
updateArtifactContent(activeArtifact.id, content);
|
|
25669
|
+
updateArtifactContent(activeArtifact.id, content, "user");
|
|
25666
25670
|
}
|
|
25667
25671
|
},
|
|
25668
25672
|
onSave: async (artifactId, content) => {
|
|
25669
25673
|
try {
|
|
25670
25674
|
const res = await artifactService.updateContent(artifactId, content);
|
|
25671
25675
|
if (res.success) {
|
|
25672
|
-
updateArtifactContent(artifactId, content);
|
|
25676
|
+
updateArtifactContent(artifactId, content, "user");
|
|
25673
25677
|
toast.success("\u4EA7\u7269\u5DF2\u4FDD\u5B58");
|
|
25674
25678
|
} else {
|
|
25675
25679
|
toast.error("\u4FDD\u5B58\u5931\u8D25");
|