@openviking/react 0.1.1 → 0.1.2
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/README.md +18 -15
- package/dist/3~0.js +2113 -4
- package/dist/ark-message-list-view~0.js +310 -0
- package/dist/c7~0.js +24 -0
- package/dist/components/agent-connect/agent-connect-copy.d.ts +34 -0
- package/dist/components/agent-connect/agent-connect-design.d.ts +1781 -0
- package/dist/components/agent-connect/agent-connect-detail.d.ts +13 -0
- package/dist/components/agent-connect/agent-connect-installer.d.ts +3 -0
- package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +14 -0
- package/dist/components/agent-connect/agent-connect-instructions.d.ts +145 -0
- package/dist/components/agent-connect/agent-connect-markdown.d.ts +3 -0
- package/dist/components/agent-connect/agent-connect.d.ts +3 -3
- package/dist/components/agent-connect/content-en.d.ts +137 -0
- package/dist/components/agent-connect/content-zh.d.ts +137 -0
- package/dist/components/agent-connect/style.css +495 -6
- package/dist/components/agent-connect/types.d.ts +20 -166
- package/dist/components/file-preview/file-preview-adapters.d.ts +33 -0
- package/dist/components/file-preview/file-preview-body.d.ts +24 -12
- package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +16 -0
- package/dist/components/file-preview/file-preview-breadcrumb.d.ts +21 -0
- package/dist/components/file-preview/file-preview-copy-path.d.ts +12 -0
- package/dist/components/file-preview/file-preview-editor.d.ts +22 -0
- package/dist/components/file-preview/file-preview-handle-adapters.d.ts +26 -0
- package/dist/components/file-preview/file-preview-header.d.ts +23 -14
- package/dist/components/file-preview/file-preview-labels.d.ts +15 -4
- package/dist/components/file-preview/file-preview-lazy-viewer.d.ts +3 -0
- package/dist/components/file-preview/file-preview-path.d.ts +30 -0
- package/dist/components/file-preview/file-preview-source.d.ts +24 -0
- package/dist/components/file-preview/file-preview-state.d.ts +28 -0
- package/dist/components/file-preview/file-preview-tab-row.d.ts +16 -0
- package/dist/components/file-preview/file-preview-viewer.d.ts +31 -0
- package/dist/components/file-preview/file-preview.d.ts +8 -11
- package/dist/components/file-preview/style.css +3984 -128
- package/dist/components/file-preview/types.d.ts +250 -169
- package/dist/components/file-preview/use-file-preview-actions-context.d.ts +23 -0
- package/dist/components/file-preview/use-file-preview-actions.d.ts +19 -0
- package/dist/components/file-preview/use-file-preview-editing.d.ts +21 -2
- package/dist/components/file-preview/use-file-preview-ids.d.ts +24 -0
- package/dist/components/file-preview.js +1 -442
- package/dist/components/file-tree/file-tree-body.d.ts +8 -4
- package/dist/components/file-tree/file-tree-entry-row.d.ts +9 -3
- package/dist/components/file-tree/file-tree-icons.d.ts +12 -5
- package/dist/components/file-tree/file-tree-info-labels.d.ts +21 -0
- package/dist/components/file-tree/file-tree-info-tooltip.d.ts +43 -0
- package/dist/components/file-tree/file-tree-info.d.ts +29 -0
- package/dist/components/file-tree/file-tree-keyboard.d.ts +8 -4
- package/dist/components/file-tree/file-tree-row-context.d.ts +31 -9
- package/dist/components/file-tree/file-tree-row-shared.d.ts +11 -0
- package/dist/components/file-tree/file-tree-spinner.d.ts +10 -0
- package/dist/components/file-tree/file-tree-state-row.d.ts +7 -0
- package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +22 -0
- package/dist/components/file-tree/file-tree-tooltip.d.ts +9 -3
- package/dist/components/file-tree/file-tree.d.ts +12 -1
- package/dist/components/file-tree/style.css +225 -57
- package/dist/components/file-tree/types.d.ts +183 -0
- package/dist/components/file-tree/use-file-tree-actions.d.ts +7 -0
- package/dist/components/file-tree.js +1 -1
- package/dist/components/scope-switcher/scope-panel.d.ts +9 -3
- package/dist/components/scope-switcher/scope-selector.d.ts +1 -1
- package/dist/components/scope-switcher/scope-switcher.d.ts +1 -1
- package/dist/components/scope-switcher/style.css +282 -76
- package/dist/components/scope-switcher/types.d.ts +230 -108
- package/dist/components/style.css +13845 -372
- package/dist/components/tui/command-catalog.d.ts +58 -0
- package/dist/components/tui/command-completion.d.ts +19 -0
- package/dist/components/tui/command-definitions.d.ts +10 -0
- package/dist/components/tui/command-input.d.ts +16 -0
- package/dist/components/tui/style.css +1543 -5
- package/dist/components/tui/tui-assist.d.ts +15 -0
- package/dist/components/tui/tui-code-block.d.ts +8 -0
- package/dist/components/tui/tui-command-help.d.ts +9 -0
- package/dist/components/tui/tui-command-text.d.ts +6 -0
- package/dist/components/tui/tui-composer.d.ts +24 -0
- package/dist/components/tui/tui-copy-button.d.ts +9 -0
- package/dist/components/tui/tui-input-mirror.d.ts +14 -0
- package/dist/components/tui/tui-labels-zh.d.ts +2 -0
- package/dist/components/tui/tui-labels.d.ts +5 -0
- package/dist/components/tui/tui-markdown-renderers.d.ts +10 -0
- package/dist/components/tui/tui-markdown.d.ts +6 -0
- package/dist/components/tui/tui-param-hint.d.ts +7 -0
- package/dist/components/tui/tui-record-time.d.ts +11 -0
- package/dist/components/tui/tui-record.d.ts +13 -0
- package/dist/components/tui/tui-resource-preview.d.ts +10 -0
- package/dist/components/tui/tui-resource-tree.d.ts +10 -0
- package/dist/components/tui/tui-result-header.d.ts +7 -0
- package/dist/components/tui/tui-result-text.d.ts +5 -0
- package/dist/components/tui/tui-search-list.d.ts +8 -0
- package/dist/components/tui/tui-skeleton.d.ts +6 -0
- package/dist/components/tui/tui-status-card.d.ts +7 -0
- package/dist/components/tui/tui-text.d.ts +10 -0
- package/dist/components/tui/tui-uri-text.d.ts +19 -0
- package/dist/components/tui/tui-write-result.d.ts +7 -0
- package/dist/components/tui/tui.d.ts +10 -2
- package/dist/components/tui/types.d.ts +57 -15
- package/dist/components/tui/use-tui-assist-position.d.ts +3 -0
- package/dist/components/tui/use-tui-completion.d.ts +14 -0
- package/dist/components/tui/use-tui-composer-keyboard.d.ts +25 -0
- package/dist/components/viking-bot/ark-adapter.d.ts +45 -0
- package/dist/components/viking-bot/ark-message-body.d.ts +16 -0
- package/dist/components/viking-bot/ark-message-list-view.d.ts +7 -0
- package/dist/components/viking-bot/ark-message-row.d.ts +19 -0
- package/dist/components/viking-bot/index.d.ts +10 -0
- package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +10 -0
- package/dist/components/viking-bot/interaction/index.d.ts +4 -0
- package/dist/components/viking-bot/interaction/labels.d.ts +7 -0
- package/dist/components/viking-bot/interaction/lazy-interaction.d.ts +3 -0
- package/dist/components/viking-bot/interaction/schedule-input.d.ts +13 -0
- package/dist/components/viking-bot/interaction/style.css +189 -0
- package/dist/components/viking-bot/interaction/types.d.ts +188 -0
- package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +9 -0
- package/dist/components/viking-bot/interaction.js +2 -0
- package/dist/components/viking-bot/labels.d.ts +2 -0
- package/dist/components/viking-bot/lazy-composer.d.ts +3 -0
- package/dist/components/viking-bot/message-groups.d.ts +12 -0
- package/dist/components/viking-bot/model.d.ts +252 -0
- package/dist/components/viking-bot/render-part.d.ts +12 -0
- package/dist/components/viking-bot/style.css +7135 -0
- package/dist/components/viking-bot/style.js +0 -0
- package/dist/components/viking-bot/types.d.ts +140 -0
- package/dist/components/viking-bot/viking-bot-composer.d.ts +6 -0
- package/dist/components/viking-bot/viking-bot-message-list.d.ts +3 -0
- package/dist/components/viking-bot/viking-bot.d.ts +16 -0
- package/dist/components/viking-bot.js +4 -0
- package/dist/c~0.js +201 -0
- package/dist/file-preview-viewer~0.js +191 -0
- package/dist/f~0.js +149 -77
- package/dist/g~0.js +1207 -0
- package/dist/h~0.js +58 -0
- package/dist/icons/file-type-icon.d.ts +31 -0
- package/dist/icons/index.d.ts +33 -23
- package/dist/icons/nextjs-icon.d.ts +19 -0
- package/dist/icons.js +1 -25
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/k~0.js +1440 -0
- package/dist/lk~0.js +25 -12
- package/dist/modules/console/style.css +83 -1
- package/dist/modules/file-browser/style.css +89 -6
- package/dist/modules/scope-cascade/style.css +282 -76
- package/dist/modules/style.css +533 -110
- package/dist/n~0.js +434 -206
- package/dist/shared/components/tooltip/index.d.ts +1 -0
- package/dist/shared/components/tooltip/tooltip.d.ts +25 -0
- package/dist/shared/components/tooltip/types.d.ts +42 -0
- package/dist/shared/components/tooltip/use-tooltip-position.d.ts +38 -0
- package/dist/style.css +14451 -474
- package/dist/u~0.js +1597 -4
- package/dist/viking-bot-composer~0.js +164 -0
- package/dist/viking-bot-interaction~0.js +284 -0
- package/dist/w~0.js +19 -0
- package/package.json +18 -10
- package/dist/components/file-preview/file-preview-icons.d.ts +0 -2
- package/dist/components/file-preview/file-preview-operations.d.ts +0 -1
- package/dist/components/file-tree/file-tree-dom.d.ts +0 -4
- package/dist/components/file-tree/file-tree-labels.d.ts +0 -5
- package/dist/components/file-tree/file-tree-rows.d.ts +0 -12
- package/dist/i~0.js +0 -21
- package/dist/modules/task-center/columns.d.ts +0 -129
- package/dist/modules/task-center/index.d.ts +0 -1
- package/dist/modules/task-center/style.css +0 -29
- package/dist/modules/task-center/task-center.d.ts +0 -4
- package/dist/modules/task-center/types.d.ts +0 -168
- package/dist/modules/task-center.js +0 -1
- /package/dist/{modules/task-center → components/viking-bot/interaction}/style.js +0 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChatMessageList } from "@ark-design/ui/message-list";
|
|
3
|
+
import { Bubble } from "@ark-design/ui/bubble";
|
|
4
|
+
import { ErrorCard } from "@ark-design/ui/error-card";
|
|
5
|
+
import { ActivityTimeline } from "@ark-design/ui/activity-timeline";
|
|
6
|
+
import { MDRenderer } from "@ark-design/ui/markdown-renderer";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { groupActivityParts, toRenderItems, DEFAULT_LABELS } from "./c~0.js";
|
|
9
|
+
import { messageText, groupMessages } from "./h~0.js";
|
|
10
|
+
function renderPart(part, context) {
|
|
11
|
+
const { labels, onOpenUri } = context;
|
|
12
|
+
if ('text' === part.type) return 'markdown' === part.format ? /*#__PURE__*/ jsx("div", {
|
|
13
|
+
className: "ov-viking-bot__text ov-viking-bot__text--markdown",
|
|
14
|
+
children: part.text
|
|
15
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
16
|
+
className: "ov-viking-bot__text",
|
|
17
|
+
children: part.text
|
|
18
|
+
});
|
|
19
|
+
if ('reasoning' === part.type) return /*#__PURE__*/ jsxs("details", {
|
|
20
|
+
className: "ov-viking-bot__reasoning",
|
|
21
|
+
open: part.running,
|
|
22
|
+
children: [
|
|
23
|
+
/*#__PURE__*/ jsxs("summary", {
|
|
24
|
+
children: [
|
|
25
|
+
labels.reasoning,
|
|
26
|
+
part.durationMs ? ` · ${Math.round(part.durationMs / 1000)}s` : ''
|
|
27
|
+
]
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ jsx("div", {
|
|
30
|
+
className: "ov-viking-bot__reasoning-body",
|
|
31
|
+
children: part.text
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
if ('iteration' === part.type) return /*#__PURE__*/ jsxs("div", {
|
|
36
|
+
className: "ov-viking-bot__iteration",
|
|
37
|
+
role: "separator",
|
|
38
|
+
children: [
|
|
39
|
+
"#",
|
|
40
|
+
part.iteration
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
if ('context' === part.type) return /*#__PURE__*/ jsx("button", {
|
|
44
|
+
type: "button",
|
|
45
|
+
className: "ov-viking-bot__context",
|
|
46
|
+
title: part.abstract,
|
|
47
|
+
onClick: ()=>onOpenUri?.(part.uri),
|
|
48
|
+
children: part.label ?? part.uri
|
|
49
|
+
});
|
|
50
|
+
if ('tool' === part.type) return /*#__PURE__*/ jsxs("details", {
|
|
51
|
+
className: "ov-viking-bot__tool",
|
|
52
|
+
open: 'running' === part.status,
|
|
53
|
+
children: [
|
|
54
|
+
/*#__PURE__*/ jsxs("summary", {
|
|
55
|
+
children: [
|
|
56
|
+
/*#__PURE__*/ jsx("span", {
|
|
57
|
+
className: "ov-viking-bot__tool-name",
|
|
58
|
+
children: part.name
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ jsx("span", {
|
|
61
|
+
className: "ov-viking-bot__tool-status",
|
|
62
|
+
children: labels[`tool${capitalize(part.status)}`] ?? part.status
|
|
63
|
+
}),
|
|
64
|
+
part.durationMs ? /*#__PURE__*/ jsx("span", {
|
|
65
|
+
children: `${part.durationMs}ms`
|
|
66
|
+
}) : null
|
|
67
|
+
]
|
|
68
|
+
}),
|
|
69
|
+
part.input ? /*#__PURE__*/ jsx("pre", {
|
|
70
|
+
className: "ov-viking-bot__tool-input",
|
|
71
|
+
children: JSON.stringify(part.input, null, 2)
|
|
72
|
+
}) : null,
|
|
73
|
+
part.output ? /*#__PURE__*/ jsx("pre", {
|
|
74
|
+
className: "ov-viking-bot__tool-output",
|
|
75
|
+
children: part.output
|
|
76
|
+
}) : null
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
if ('tool_result' === part.type) return /*#__PURE__*/ jsx("pre", {
|
|
80
|
+
className: part.isError ? 'ov-viking-bot__tool-output ov-viking-bot__tool-output--error' : 'ov-viking-bot__tool-output',
|
|
81
|
+
children: part.output
|
|
82
|
+
});
|
|
83
|
+
if ('image' === part.type) return /*#__PURE__*/ jsx("img", {
|
|
84
|
+
className: "ov-viking-bot__image",
|
|
85
|
+
src: part.src,
|
|
86
|
+
alt: part.alt ?? ''
|
|
87
|
+
});
|
|
88
|
+
return /*#__PURE__*/ jsx("button", {
|
|
89
|
+
type: "button",
|
|
90
|
+
className: "ov-viking-bot__attachment",
|
|
91
|
+
onClick: ()=>part.uri && onOpenUri?.(part.uri),
|
|
92
|
+
children: part.name
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function capitalize(value) {
|
|
96
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
97
|
+
}
|
|
98
|
+
function MessageText({ text, streaming, format }) {
|
|
99
|
+
if ('plain' === format) return /*#__PURE__*/ jsx("div", {
|
|
100
|
+
className: "ov-viking-bot__text",
|
|
101
|
+
children: text
|
|
102
|
+
});
|
|
103
|
+
return /*#__PURE__*/ jsx(MDRenderer, {
|
|
104
|
+
className: "ov-viking-bot__text ov-viking-bot__text--markdown",
|
|
105
|
+
markdown: text,
|
|
106
|
+
showIndicator: streaming
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function ActivityGroup({ id, items, running, labels, onOpenUri }) {
|
|
110
|
+
const [expanded, setExpanded] = useState(running);
|
|
111
|
+
const duration = items.reduce((total, item)=>total + (item.durationMs ?? 0), 0);
|
|
112
|
+
const summary = running ? labels.thinking : duration > 0 ? `${labels.reasoning} · ${Math.round(duration / 1000)}s` : labels.reasoning;
|
|
113
|
+
return /*#__PURE__*/ jsxs("section", {
|
|
114
|
+
className: "ov-viking-bot__activity",
|
|
115
|
+
"data-group": id,
|
|
116
|
+
children: [
|
|
117
|
+
/*#__PURE__*/ jsx("button", {
|
|
118
|
+
type: "button",
|
|
119
|
+
className: "ov-viking-bot__activity-toggle",
|
|
120
|
+
"aria-expanded": expanded,
|
|
121
|
+
onClick: ()=>setExpanded((current)=>!current),
|
|
122
|
+
children: summary
|
|
123
|
+
}),
|
|
124
|
+
expanded ? /*#__PURE__*/ jsx(ActivityTimeline, {
|
|
125
|
+
items: items,
|
|
126
|
+
density: "compact",
|
|
127
|
+
defaultExpanded: true,
|
|
128
|
+
onOpenSearchResult: (result)=>onOpenUri?.(result.url)
|
|
129
|
+
}) : null
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function MessageBody({ message, labels, onOpenUri }) {
|
|
134
|
+
const activity = message.parts.filter((part)=>'reasoning' === part.type || 'tool' === part.type);
|
|
135
|
+
const rest = message.parts.filter((part)=>'reasoning' !== part.type && 'tool' !== part.type);
|
|
136
|
+
const { groups, order } = groupActivityParts(activity);
|
|
137
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
138
|
+
children: [
|
|
139
|
+
order.map((key)=>{
|
|
140
|
+
const group = groups.get(key);
|
|
141
|
+
if (!group) return null;
|
|
142
|
+
return /*#__PURE__*/ jsx(ActivityGroup, {
|
|
143
|
+
id: group.id,
|
|
144
|
+
items: group.items,
|
|
145
|
+
running: group.items.some((item)=>'running' === item.status),
|
|
146
|
+
labels: labels,
|
|
147
|
+
onOpenUri: onOpenUri
|
|
148
|
+
}, group.id);
|
|
149
|
+
}),
|
|
150
|
+
rest.map((part, index)=>'text' === part.type ? /*#__PURE__*/ jsx(MessageText, {
|
|
151
|
+
text: part.text,
|
|
152
|
+
format: part.format,
|
|
153
|
+
streaming: message.streaming
|
|
154
|
+
}, index) : /*#__PURE__*/ jsx("div", {
|
|
155
|
+
children: renderPart(part, {
|
|
156
|
+
labels,
|
|
157
|
+
onOpenUri
|
|
158
|
+
})
|
|
159
|
+
}, index))
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function MessageActions({ message, labels, onCopy, onMessageAction }) {
|
|
164
|
+
const text = messageText(message);
|
|
165
|
+
const actions = message.actions ?? (message.action ? [
|
|
166
|
+
{
|
|
167
|
+
messageId: message.id,
|
|
168
|
+
action: message.action
|
|
169
|
+
}
|
|
170
|
+
] : []);
|
|
171
|
+
if (0 === actions.length && !onCopy) return null;
|
|
172
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
173
|
+
className: "ov-viking-bot__message-actions",
|
|
174
|
+
children: [
|
|
175
|
+
actions.map(({ messageId, action })=>/*#__PURE__*/ jsx("button", {
|
|
176
|
+
type: "button",
|
|
177
|
+
className: "ov-viking-bot__message-action",
|
|
178
|
+
disabled: Boolean(action.disabledReason) || 'pending' === action.status || 'success' === action.status,
|
|
179
|
+
title: action.disabledReason,
|
|
180
|
+
onClick: ()=>onMessageAction?.(messageId, action.key),
|
|
181
|
+
children: action.label ?? action.key
|
|
182
|
+
}, `${messageId}:${action.key}`)),
|
|
183
|
+
onCopy && text ? /*#__PURE__*/ jsx("button", {
|
|
184
|
+
type: "button",
|
|
185
|
+
className: "ov-viking-bot__copy",
|
|
186
|
+
onClick: ()=>onCopy(text),
|
|
187
|
+
children: labels.copy
|
|
188
|
+
}) : null
|
|
189
|
+
]
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function VikingBotMessageRow({ message, labels, onOpenUri, onCopy, onMessageAction, renderMessage }) {
|
|
193
|
+
if (renderMessage) return /*#__PURE__*/ jsx("div", {
|
|
194
|
+
className: "ov-viking-bot__message",
|
|
195
|
+
children: renderMessage(message)
|
|
196
|
+
});
|
|
197
|
+
if ('system' === message.role) return /*#__PURE__*/ jsx(ErrorCard, {
|
|
198
|
+
className: 'error' === message.tone ? 'ov-viking-bot__notice ov-viking-bot__notice--error' : 'ov-viking-bot__notice',
|
|
199
|
+
content: messageText(message)
|
|
200
|
+
});
|
|
201
|
+
return /*#__PURE__*/ jsx(Bubble, {
|
|
202
|
+
className: `ov-viking-bot__message ov-viking-bot__message--${message.role}`,
|
|
203
|
+
placement: 'user' === message.role ? 'end' : 'start',
|
|
204
|
+
variant: 'user' === message.role ? 'filled' : 'text',
|
|
205
|
+
content: null,
|
|
206
|
+
footer: /*#__PURE__*/ jsx(MessageActions, {
|
|
207
|
+
message: message,
|
|
208
|
+
labels: labels,
|
|
209
|
+
onCopy: onCopy,
|
|
210
|
+
onMessageAction: onMessageAction
|
|
211
|
+
}),
|
|
212
|
+
children: /*#__PURE__*/ jsx(MessageBody, {
|
|
213
|
+
message: message,
|
|
214
|
+
labels: labels,
|
|
215
|
+
onOpenUri: onOpenUri
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function VikingBotStreamingRow({ streaming, labels, onOpenUri }) {
|
|
220
|
+
if (0 === streaming.parts.length) return /*#__PURE__*/ jsx(Bubble, {
|
|
221
|
+
className: "ov-viking-bot__message ov-viking-bot__message--assistant",
|
|
222
|
+
placement: "start",
|
|
223
|
+
variant: "text",
|
|
224
|
+
loading: true
|
|
225
|
+
});
|
|
226
|
+
return /*#__PURE__*/ jsx(Bubble, {
|
|
227
|
+
className: "ov-viking-bot__message ov-viking-bot__message--assistant",
|
|
228
|
+
placement: "start",
|
|
229
|
+
variant: "text",
|
|
230
|
+
content: null,
|
|
231
|
+
children: /*#__PURE__*/ jsx(MessageBody, {
|
|
232
|
+
message: {
|
|
233
|
+
id: '__streaming__',
|
|
234
|
+
role: 'assistant',
|
|
235
|
+
parts: streaming.parts,
|
|
236
|
+
streaming: true
|
|
237
|
+
},
|
|
238
|
+
labels: labels,
|
|
239
|
+
onOpenUri: onOpenUri
|
|
240
|
+
})
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
const INITIAL_TARGET = {
|
|
244
|
+
kind: 'end',
|
|
245
|
+
behavior: 'auto'
|
|
246
|
+
};
|
|
247
|
+
const SCROLLER_STYLE = {
|
|
248
|
+
paddingLeft: 16,
|
|
249
|
+
paddingRight: 16,
|
|
250
|
+
paddingBottom: 24
|
|
251
|
+
};
|
|
252
|
+
const TURN_ANCHOR = {
|
|
253
|
+
behavior: 'smooth',
|
|
254
|
+
mode: 'bottom'
|
|
255
|
+
};
|
|
256
|
+
const AT_END_THRESHOLD = 8;
|
|
257
|
+
const estimateSize = (item)=>{
|
|
258
|
+
if (item.streaming) return 96;
|
|
259
|
+
const message = item.message;
|
|
260
|
+
if (!message) return 96;
|
|
261
|
+
if ('system' === message.role) return 56;
|
|
262
|
+
const textLength = message.parts.reduce((total, part)=>total + ('text' === part.type ? part.text.length : 0), 0);
|
|
263
|
+
const activityCount = message.parts.filter((part)=>'reasoning' === part.type || 'tool' === part.type).length;
|
|
264
|
+
return Math.max(72, Math.min(640, 72 + 0.4 * textLength + 48 * activityCount));
|
|
265
|
+
};
|
|
266
|
+
function VikingBotMessageListView({ messages, className, streaming, footer, listKey, onOpenUri, onCopy, onMessageAction, renderMessage, labels: overrides }) {
|
|
267
|
+
const labels = {
|
|
268
|
+
...DEFAULT_LABELS,
|
|
269
|
+
...overrides
|
|
270
|
+
};
|
|
271
|
+
const items = toRenderItems(messages, streaming, groupMessages);
|
|
272
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
273
|
+
className: [
|
|
274
|
+
'ov-viking-bot__list',
|
|
275
|
+
className
|
|
276
|
+
].filter(Boolean).join(' '),
|
|
277
|
+
children: [
|
|
278
|
+
/*#__PURE__*/ jsx(ChatMessageList, {
|
|
279
|
+
listKey: listKey ?? 'viking-bot',
|
|
280
|
+
items: items,
|
|
281
|
+
getItemKey: (item)=>item.id,
|
|
282
|
+
estimateItemSize: estimateSize,
|
|
283
|
+
initialTarget: INITIAL_TARGET,
|
|
284
|
+
followOutput: streaming ? 'smooth' : false,
|
|
285
|
+
turnAnchor: TURN_ANCHOR,
|
|
286
|
+
atEndThreshold: AT_END_THRESHOLD,
|
|
287
|
+
scrollerStyle: SCROLLER_STYLE,
|
|
288
|
+
shortContentAlign: "start",
|
|
289
|
+
overscan: 480,
|
|
290
|
+
renderItem: ({ item })=>item.streaming ? /*#__PURE__*/ jsx(VikingBotStreamingRow, {
|
|
291
|
+
streaming: item.streaming,
|
|
292
|
+
labels: labels,
|
|
293
|
+
onOpenUri: onOpenUri
|
|
294
|
+
}) : item.message ? /*#__PURE__*/ jsx(VikingBotMessageRow, {
|
|
295
|
+
message: item.message,
|
|
296
|
+
labels: labels,
|
|
297
|
+
onOpenUri: onOpenUri,
|
|
298
|
+
onCopy: onCopy,
|
|
299
|
+
onMessageAction: onMessageAction,
|
|
300
|
+
renderMessage: renderMessage
|
|
301
|
+
}) : null
|
|
302
|
+
}),
|
|
303
|
+
footer ? /*#__PURE__*/ jsx("div", {
|
|
304
|
+
className: "ov-viking-bot__footer",
|
|
305
|
+
children: footer
|
|
306
|
+
}) : null
|
|
307
|
+
]
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
export { VikingBotMessageListView };
|
package/dist/c7~0.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const DEFAULT_INTERACTION_LABELS = {
|
|
2
|
+
title: 'Needs your input',
|
|
3
|
+
submit: 'Submit',
|
|
4
|
+
cancel: 'Cancel',
|
|
5
|
+
other: 'Other',
|
|
6
|
+
submitted: 'Submitted',
|
|
7
|
+
cancelled: 'Cancelled',
|
|
8
|
+
progress: (index, total)=>`${index + 1} / ${total}`,
|
|
9
|
+
scheduleNone: 'Do not schedule',
|
|
10
|
+
scheduleDaily: 'Every day',
|
|
11
|
+
scheduleWeekly: 'Every week',
|
|
12
|
+
scheduleTime: 'Time',
|
|
13
|
+
scheduleWeekday: 'Weekday',
|
|
14
|
+
weekdays: [
|
|
15
|
+
'Monday',
|
|
16
|
+
'Tuesday',
|
|
17
|
+
'Wednesday',
|
|
18
|
+
'Thursday',
|
|
19
|
+
'Friday',
|
|
20
|
+
'Saturday',
|
|
21
|
+
'Sunday'
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
export { DEFAULT_INTERACTION_LABELS };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const AGENT_CONNECT_COPY: {
|
|
2
|
+
zh: {
|
|
3
|
+
title: string;
|
|
4
|
+
mainstream: string;
|
|
5
|
+
custom: string;
|
|
6
|
+
integration: string;
|
|
7
|
+
instructions: string;
|
|
8
|
+
copy: string;
|
|
9
|
+
copyMarkdown: string;
|
|
10
|
+
copied: string;
|
|
11
|
+
failed: string;
|
|
12
|
+
notice: string;
|
|
13
|
+
seeAgreement: string;
|
|
14
|
+
agreement: string;
|
|
15
|
+
apiKey: string;
|
|
16
|
+
overseas: string;
|
|
17
|
+
};
|
|
18
|
+
en: {
|
|
19
|
+
title: string;
|
|
20
|
+
mainstream: string;
|
|
21
|
+
custom: string;
|
|
22
|
+
integration: string;
|
|
23
|
+
instructions: string;
|
|
24
|
+
copy: string;
|
|
25
|
+
copyMarkdown: string;
|
|
26
|
+
copied: string;
|
|
27
|
+
failed: string;
|
|
28
|
+
notice: string;
|
|
29
|
+
seeAgreement: string;
|
|
30
|
+
agreement: string;
|
|
31
|
+
apiKey: string;
|
|
32
|
+
overseas: string;
|
|
33
|
+
};
|
|
34
|
+
};
|