@docyrus/ui-pro-ai-assistant 0.0.2 → 0.0.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/package.json +2 -3
- package/src/components/assistant-animations.tsx +0 -29
- package/src/components/assistant-dialogs.tsx +0 -235
- package/src/components/code-view.tsx +0 -278
- package/src/components/create-agent-task.tsx +0 -104
- package/src/components/create-new-work-version.tsx +0 -30
- package/src/components/extract-web.tsx +0 -160
- package/src/components/forward-to-agent.tsx +0 -90
- package/src/components/generate-chart.tsx +0 -101
- package/src/components/generative-action-button.tsx +0 -122
- package/src/components/generative-tool.tsx +0 -685
- package/src/components/generative-ui-object.tsx +0 -210
- package/src/components/input-area.tsx +0 -1209
- package/src/components/json-schema-layout.tsx +0 -326
- package/src/components/list-item-card.tsx +0 -92
- package/src/components/mermaid-diagram.tsx +0 -192
- package/src/components/preview-image.tsx +0 -47
- package/src/components/request-approval.tsx +0 -48
- package/src/components/request-user-input.tsx +0 -270
- package/src/components/search-web.tsx +0 -319
- package/src/components/sheet-command.tsx +0 -88
- package/src/components/shell-canvas.tsx +0 -122
- package/src/components/show-advanced-data-table.tsx +0 -352
- package/src/components/show-generated-content-options.tsx +0 -93
- package/src/components/show-people-cards.tsx +0 -180
- package/src/components/subagent-tool.tsx +0 -180
- package/src/components/text-editor-tool.tsx +0 -328
- package/src/components/work-canvas.tsx +0 -88
- package/src/components/work-card.tsx +0 -42
- package/src/declarations.d.ts +0 -1
- package/src/docy-assistant.tsx +0 -1962
- package/src/hooks/index.ts +0 -7
- package/src/hooks/use-assistant-api.ts +0 -507
- package/src/hooks/use-deployment-data.ts +0 -162
- package/src/hooks/use-project-state.ts +0 -347
- package/src/hooks/use-session-state.ts +0 -207
- package/src/hooks/use-speech-recognition.ts +0 -137
- package/src/hooks/use-ui-state.ts +0 -185
- package/src/hooks/use-works-state.ts +0 -146
- package/src/i18n/context.tsx +0 -253
- package/src/i18n/index.ts +0 -19
- package/src/i18n/locales/de.json +0 -198
- package/src/i18n/locales/el.json +0 -198
- package/src/i18n/locales/en.json +0 -226
- package/src/i18n/locales/es.json +0 -198
- package/src/i18n/locales/fr.json +0 -198
- package/src/i18n/locales/it.json +0 -198
- package/src/i18n/locales/pt.json +0 -198
- package/src/i18n/locales/sl.json +0 -198
- package/src/i18n/locales/tr.json +0 -211
- package/src/i18n/types.ts +0 -23
- package/src/i18n/use-translation.ts +0 -17
- package/src/index.ts +0 -18
- package/src/internal/plate-editor/editor/auth-context.ts +0 -11
- package/src/internal/plate-editor/editor/editor-base-kit.tsx +0 -39
- package/src/internal/plate-editor/editor/editor-kit.tsx +0 -89
- package/src/internal/plate-editor/editor/plate-editor.tsx +0 -75
- package/src/internal/plate-editor/editor/plate-types.ts +0 -126
- package/src/internal/plate-editor/editor/plugins/ai-kit.tsx +0 -172
- package/src/internal/plate-editor/editor/plugins/autoformat-kit.tsx +0 -211
- package/src/internal/plate-editor/editor/plugins/basic-blocks-base-kit.tsx +0 -26
- package/src/internal/plate-editor/editor/plugins/basic-blocks-kit.tsx +0 -51
- package/src/internal/plate-editor/editor/plugins/basic-marks-base-kit.tsx +0 -24
- package/src/internal/plate-editor/editor/plugins/basic-marks-kit.tsx +0 -38
- package/src/internal/plate-editor/editor/plugins/basic-nodes-kit.tsx +0 -6
- package/src/internal/plate-editor/editor/plugins/block-menu-kit.tsx +0 -14
- package/src/internal/plate-editor/editor/plugins/block-placeholder-kit.tsx +0 -17
- package/src/internal/plate-editor/editor/plugins/block-selection-kit.tsx +0 -31
- package/src/internal/plate-editor/editor/plugins/callout-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/callout-kit.tsx +0 -7
- package/src/internal/plate-editor/editor/plugins/code-block-base-kit.tsx +0 -23
- package/src/internal/plate-editor/editor/plugins/code-block-kit.tsx +0 -26
- package/src/internal/plate-editor/editor/plugins/column-base-kit.tsx +0 -8
- package/src/internal/plate-editor/editor/plugins/column-kit.tsx +0 -7
- package/src/internal/plate-editor/editor/plugins/comment-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/comment-kit.tsx +0 -174
- package/src/internal/plate-editor/editor/plugins/copilot-kit.tsx +0 -68
- package/src/internal/plate-editor/editor/plugins/cursor-overlay-kit.tsx +0 -13
- package/src/internal/plate-editor/editor/plugins/date-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/date-kit.tsx +0 -7
- package/src/internal/plate-editor/editor/plugins/discussion-kit.tsx +0 -36
- package/src/internal/plate-editor/editor/plugins/dnd-kit.tsx +0 -27
- package/src/internal/plate-editor/editor/plugins/docx-export-kit.tsx +0 -43
- package/src/internal/plate-editor/editor/plugins/docx-kit.tsx +0 -6
- package/src/internal/plate-editor/editor/plugins/emoji-kit.tsx +0 -15
- package/src/internal/plate-editor/editor/plugins/exit-break-kit.tsx +0 -12
- package/src/internal/plate-editor/editor/plugins/floating-toolbar-kit.tsx +0 -19
- package/src/internal/plate-editor/editor/plugins/font-base-kit.tsx +0 -36
- package/src/internal/plate-editor/editor/plugins/font-kit.tsx +0 -47
- package/src/internal/plate-editor/editor/plugins/indent-base-kit.tsx +0 -19
- package/src/internal/plate-editor/editor/plugins/indent-kit.tsx +0 -22
- package/src/internal/plate-editor/editor/plugins/link-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/link-kit.tsx +0 -35
- package/src/internal/plate-editor/editor/plugins/list-base-kit.tsx +0 -24
- package/src/internal/plate-editor/editor/plugins/list-kit.tsx +0 -27
- package/src/internal/plate-editor/editor/plugins/markdown-kit.tsx +0 -18
- package/src/internal/plate-editor/editor/plugins/math-base-kit.tsx +0 -8
- package/src/internal/plate-editor/editor/plugins/math-kit.tsx +0 -10
- package/src/internal/plate-editor/editor/plugins/media-base-kit.tsx +0 -37
- package/src/internal/plate-editor/editor/plugins/media-kit.tsx +0 -53
- package/src/internal/plate-editor/editor/plugins/mention-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/mention-kit.tsx +0 -36
- package/src/internal/plate-editor/editor/plugins/slash-kit.tsx +0 -17
- package/src/internal/plate-editor/editor/plugins/suggestion-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/suggestion-kit.tsx +0 -95
- package/src/internal/plate-editor/editor/plugins/table-base-kit.tsx +0 -20
- package/src/internal/plate-editor/editor/plugins/table-kit.tsx +0 -22
- package/src/internal/plate-editor/editor/plugins/toc-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/toc-kit.tsx +0 -14
- package/src/internal/plate-editor/editor/plugins/toggle-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/toggle-kit.tsx +0 -9
- package/src/internal/plate-editor/editor/transforms.ts +0 -165
- package/src/internal/plate-editor/editor/use-chat.ts +0 -152
- package/src/internal/plate-editor/hooks/index.ts +0 -3
- package/src/internal/plate-editor/hooks/use-copy-to-clipboard.ts +0 -31
- package/src/internal/plate-editor/hooks/use-is-touch-device.ts +0 -26
- package/src/internal/plate-editor/hooks/use-lock-scroll.ts +0 -21
- package/src/internal/plate-editor/hooks/use-media-query.ts +0 -44
- package/src/internal/plate-editor/hooks/use-mounted.ts +0 -18
- package/src/internal/plate-editor/hooks/use-on-click-outside.ts +0 -114
- package/src/internal/plate-editor/hooks/use-upload-file.ts +0 -81
- package/src/internal/plate-editor/i18n/context.tsx +0 -58
- package/src/internal/plate-editor/i18n/index.ts +0 -3
- package/src/internal/plate-editor/i18n/locales/de.json +0 -57
- package/src/internal/plate-editor/i18n/locales/el.json +0 -57
- package/src/internal/plate-editor/i18n/locales/en.json +0 -57
- package/src/internal/plate-editor/i18n/locales/es.json +0 -57
- package/src/internal/plate-editor/i18n/locales/fr.json +0 -57
- package/src/internal/plate-editor/i18n/locales/it.json +0 -57
- package/src/internal/plate-editor/i18n/locales/pt.json +0 -57
- package/src/internal/plate-editor/i18n/locales/sl.json +0 -57
- package/src/internal/plate-editor/i18n/locales/tr.json +0 -57
- package/src/internal/plate-editor/i18n/types.ts +0 -59
- package/src/internal/plate-editor/i18n/use-translation.ts +0 -22
- package/src/internal/plate-editor/index.ts +0 -39
- package/src/internal/plate-editor/lib/ai-output-converter.ts +0 -153
- package/src/internal/plate-editor/lib/download-file.ts +0 -17
- package/src/internal/plate-editor/plate-ui/ai-chat-editor.tsx +0 -24
- package/src/internal/plate-editor/plate-ui/ai-menu.tsx +0 -828
- package/src/internal/plate-editor/plate-ui/ai-node.tsx +0 -41
- package/src/internal/plate-editor/plate-ui/ai-toolbar-button.tsx +0 -25
- package/src/internal/plate-editor/plate-ui/alert-dialog.tsx +0 -145
- package/src/internal/plate-editor/plate-ui/align-toolbar-button.tsx +0 -88
- package/src/internal/plate-editor/plate-ui/avatar.tsx +0 -3
- package/src/internal/plate-editor/plate-ui/block-context-menu.tsx +0 -104
- package/src/internal/plate-editor/plate-ui/block-discussion.tsx +0 -364
- package/src/internal/plate-editor/plate-ui/block-draggable.tsx +0 -557
- package/src/internal/plate-editor/plate-ui/block-list-static.tsx +0 -77
- package/src/internal/plate-editor/plate-ui/block-list.tsx +0 -85
- package/src/internal/plate-editor/plate-ui/block-menu.tsx +0 -555
- package/src/internal/plate-editor/plate-ui/block-selection.tsx +0 -47
- package/src/internal/plate-editor/plate-ui/block-suggestion.tsx +0 -469
- package/src/internal/plate-editor/plate-ui/blockquote-node-static.tsx +0 -10
- package/src/internal/plate-editor/plate-ui/blockquote-node.tsx +0 -11
- package/src/internal/plate-editor/plate-ui/button.tsx +0 -201
- package/src/internal/plate-editor/plate-ui/calendar.tsx +0 -3
- package/src/internal/plate-editor/plate-ui/callout-node-static.tsx +0 -76
- package/src/internal/plate-editor/plate-ui/callout-node.tsx +0 -54
- package/src/internal/plate-editor/plate-ui/caption.tsx +0 -47
- package/src/internal/plate-editor/plate-ui/checkbox.tsx +0 -3
- package/src/internal/plate-editor/plate-ui/code-block-node-static.tsx +0 -172
- package/src/internal/plate-editor/plate-ui/code-block-node.tsx +0 -226
- package/src/internal/plate-editor/plate-ui/code-node-static.tsx +0 -11
- package/src/internal/plate-editor/plate-ui/code-node.tsx +0 -12
- package/src/internal/plate-editor/plate-ui/column-node-static.tsx +0 -65
- package/src/internal/plate-editor/plate-ui/column-node.tsx +0 -24
- package/src/internal/plate-editor/plate-ui/command.tsx +0 -202
- package/src/internal/plate-editor/plate-ui/comment-node-static.tsx +0 -12
- package/src/internal/plate-editor/plate-ui/comment-node.tsx +0 -45
- package/src/internal/plate-editor/plate-ui/comment-toolbar-button.tsx +0 -24
- package/src/internal/plate-editor/plate-ui/comment.tsx +0 -619
- package/src/internal/plate-editor/plate-ui/cursor-overlay.tsx +0 -85
- package/src/internal/plate-editor/plate-ui/date-node-static.tsx +0 -43
- package/src/internal/plate-editor/plate-ui/date-node.tsx +0 -54
- package/src/internal/plate-editor/plate-ui/dialog.tsx +0 -445
- package/src/internal/plate-editor/plate-ui/dropdown-menu.tsx +0 -264
- package/src/internal/plate-editor/plate-ui/editor-static.tsx +0 -40
- package/src/internal/plate-editor/plate-ui/editor.tsx +0 -146
- package/src/internal/plate-editor/plate-ui/emoji-node.tsx +0 -48
- package/src/internal/plate-editor/plate-ui/emoji-toolbar-button.tsx +0 -626
- package/src/internal/plate-editor/plate-ui/equation-node-static.tsx +0 -155
- package/src/internal/plate-editor/plate-ui/equation-node.tsx +0 -226
- package/src/internal/plate-editor/plate-ui/equation-toolbar-button.tsx +0 -26
- package/src/internal/plate-editor/plate-ui/export-toolbar-button.tsx +0 -206
- package/src/internal/plate-editor/plate-ui/fixed-toolbar-buttons.tsx +0 -157
- package/src/internal/plate-editor/plate-ui/fixed-toolbar.tsx +0 -25
- package/src/internal/plate-editor/plate-ui/floating-discussion.tsx +0 -1129
- package/src/internal/plate-editor/plate-ui/floating-toolbar-buttons.tsx +0 -129
- package/src/internal/plate-editor/plate-ui/floating-toolbar.tsx +0 -97
- package/src/internal/plate-editor/plate-ui/font-color-toolbar-button.tsx +0 -209
- package/src/internal/plate-editor/plate-ui/font-size-toolbar-button.tsx +0 -152
- package/src/internal/plate-editor/plate-ui/ghost-text.tsx +0 -20
- package/src/internal/plate-editor/plate-ui/heading-node-static.tsx +0 -52
- package/src/internal/plate-editor/plate-ui/heading-node.tsx +0 -56
- package/src/internal/plate-editor/plate-ui/highlight-node-static.tsx +0 -9
- package/src/internal/plate-editor/plate-ui/highlight-node.tsx +0 -11
- package/src/internal/plate-editor/plate-ui/history-toolbar-button.tsx +0 -50
- package/src/internal/plate-editor/plate-ui/hover-card.tsx +0 -7
- package/src/internal/plate-editor/plate-ui/hr-node-static.tsx +0 -18
- package/src/internal/plate-editor/plate-ui/hr-node.tsx +0 -28
- package/src/internal/plate-editor/plate-ui/import-toolbar-button.tsx +0 -122
- package/src/internal/plate-editor/plate-ui/indent-toolbar-button.tsx +0 -32
- package/src/internal/plate-editor/plate-ui/inline-combobox.tsx +0 -409
- package/src/internal/plate-editor/plate-ui/input.tsx +0 -37
- package/src/internal/plate-editor/plate-ui/insert-toolbar-button.tsx +0 -258
- package/src/internal/plate-editor/plate-ui/label.tsx +0 -1
- package/src/internal/plate-editor/plate-ui/line-height-toolbar-button.tsx +0 -69
- package/src/internal/plate-editor/plate-ui/link-node-static.tsx +0 -15
- package/src/internal/plate-editor/plate-ui/link-node.tsx +0 -33
- package/src/internal/plate-editor/plate-ui/link-toolbar-button.tsx +0 -28
- package/src/internal/plate-editor/plate-ui/link-toolbar.tsx +0 -147
- package/src/internal/plate-editor/plate-ui/list-toolbar-button.tsx +0 -177
- package/src/internal/plate-editor/plate-ui/mark-toolbar-button.tsx +0 -34
- package/src/internal/plate-editor/plate-ui/media-audio-node-static.tsx +0 -21
- package/src/internal/plate-editor/plate-ui/media-audio-node.tsx +0 -32
- package/src/internal/plate-editor/plate-ui/media-embed-node.tsx +0 -103
- package/src/internal/plate-editor/plate-ui/media-file-node-static.tsx +0 -30
- package/src/internal/plate-editor/plate-ui/media-file-node.tsx +0 -52
- package/src/internal/plate-editor/plate-ui/media-image-node-static.tsx +0 -37
- package/src/internal/plate-editor/plate-ui/media-image-node.tsx +0 -183
- package/src/internal/plate-editor/plate-ui/media-placeholder-node.tsx +0 -441
- package/src/internal/plate-editor/plate-ui/media-preview-dialog.tsx +0 -127
- package/src/internal/plate-editor/plate-ui/media-toolbar-button.tsx +0 -227
- package/src/internal/plate-editor/plate-ui/media-toolbar.tsx +0 -214
- package/src/internal/plate-editor/plate-ui/media-upload-toast.tsx +0 -73
- package/src/internal/plate-editor/plate-ui/media-video-node-static.tsx +0 -35
- package/src/internal/plate-editor/plate-ui/media-video-node.tsx +0 -119
- package/src/internal/plate-editor/plate-ui/mention-node-static.tsx +0 -46
- package/src/internal/plate-editor/plate-ui/mention-node.tsx +0 -79
- package/src/internal/plate-editor/plate-ui/menu.tsx +0 -539
- package/src/internal/plate-editor/plate-ui/mode-toolbar-button.tsx +0 -124
- package/src/internal/plate-editor/plate-ui/more-toolbar-button.tsx +0 -34
- package/src/internal/plate-editor/plate-ui/paragraph-node-static.tsx +0 -15
- package/src/internal/plate-editor/plate-ui/paragraph-node.tsx +0 -16
- package/src/internal/plate-editor/plate-ui/popover.tsx +0 -75
- package/src/internal/plate-editor/plate-ui/progress.tsx +0 -1
- package/src/internal/plate-editor/plate-ui/remote-cursor-overlay.tsx +0 -79
- package/src/internal/plate-editor/plate-ui/resize-handle.tsx +0 -86
- package/src/internal/plate-editor/plate-ui/separator.tsx +0 -41
- package/src/internal/plate-editor/plate-ui/slash-node.tsx +0 -433
- package/src/internal/plate-editor/plate-ui/spinner.tsx +0 -1
- package/src/internal/plate-editor/plate-ui/suggestion-node-static.tsx +0 -35
- package/src/internal/plate-editor/plate-ui/suggestion-node.tsx +0 -166
- package/src/internal/plate-editor/plate-ui/suggestion-toolbar-button.tsx +0 -24
- package/src/internal/plate-editor/plate-ui/table-node-static.tsx +0 -84
- package/src/internal/plate-editor/plate-ui/table-node.tsx +0 -283
- package/src/internal/plate-editor/plate-ui/table-toolbar-button.tsx +0 -252
- package/src/internal/plate-editor/plate-ui/tabs.tsx +0 -3
- package/src/internal/plate-editor/plate-ui/textarea.tsx +0 -57
- package/src/internal/plate-editor/plate-ui/toc-node-static.tsx +0 -142
- package/src/internal/plate-editor/plate-ui/toc-node.tsx +0 -57
- package/src/internal/plate-editor/plate-ui/toc-sidebar.tsx +0 -48
- package/src/internal/plate-editor/plate-ui/toggle-node-static.tsx +0 -18
- package/src/internal/plate-editor/plate-ui/toggle-node.tsx +0 -33
- package/src/internal/plate-editor/plate-ui/toggle-toolbar-button.tsx +0 -24
- package/src/internal/plate-editor/plate-ui/toggle.tsx +0 -3
- package/src/internal/plate-editor/plate-ui/toolbar.tsx +0 -378
- package/src/internal/plate-editor/plate-ui/tooltip.tsx +0 -148
- package/src/internal/plate-editor/plate-ui/turn-into-toolbar-button.tsx +0 -175
- package/src/internal/plate-editor/types/index.ts +0 -22
- package/src/internal/plate-editor/vite.ts +0 -284
- package/src/internal/sheets/components/univer-sheets.tsx +0 -1104
- package/src/internal/sheets/i18n/context.tsx +0 -183
- package/src/internal/sheets/i18n/index.ts +0 -19
- package/src/internal/sheets/i18n/locales/de.json +0 -21
- package/src/internal/sheets/i18n/locales/el.json +0 -21
- package/src/internal/sheets/i18n/locales/en.json +0 -21
- package/src/internal/sheets/i18n/locales/es.json +0 -21
- package/src/internal/sheets/i18n/locales/fr.json +0 -21
- package/src/internal/sheets/i18n/locales/it.json +0 -21
- package/src/internal/sheets/i18n/locales/pt.json +0 -21
- package/src/internal/sheets/i18n/locales/sl.json +0 -21
- package/src/internal/sheets/i18n/locales/tr.json +0 -21
- package/src/internal/sheets/i18n/types.ts +0 -23
- package/src/internal/sheets/i18n/use-translation.ts +0 -17
- package/src/internal/sheets/index.ts +0 -14
- package/src/internal/sheets/types/css.d.ts +0 -11
- package/src/internal/sheets/types/index.ts +0 -260
- package/src/internal/sheets/xlsx.ts +0 -1169
- package/src/lib/api-client.ts +0 -77
- package/src/lib/assistant-api-actions.ts +0 -549
- package/src/lib/assistant-config.tsx +0 -75
- package/src/lib/class-utils.ts +0 -40
- package/src/lib/index.ts +0 -7
- package/src/lib/message-utils.ts +0 -131
- package/src/tools/tools-schema.json +0 -512
- package/src/types/index.ts +0 -235
- package/src/views/assistant-view.tsx +0 -1137
- package/src/views/canvas-app.tsx +0 -839
- package/src/views/canvas-code.tsx +0 -93
- package/src/views/canvas-deep-research.tsx +0 -44
- package/src/views/canvas-image.tsx +0 -25
- package/src/views/canvas-record-view.tsx +0 -285
- package/src/views/canvas-spreadsheet.tsx +0 -125
- package/src/views/canvas-text.tsx +0 -52
- package/src/views/canvas.tsx +0 -274
- package/src/views/chat-panel.tsx +0 -149
- package/src/views/index.ts +0 -20
- package/src/views/memories-panel.tsx +0 -365
- package/src/views/message-list.tsx +0 -370
- package/src/views/project-detail.tsx +0 -257
- package/src/views/projects-panel.tsx +0 -131
- package/src/views/sessions-list.tsx +0 -98
- package/src/views/sidebar-content.tsx +0 -256
- package/src/views/work-detail.tsx +0 -98
- package/src/vite.ts +0 -64
- package/src/worker.ts +0 -203
|
@@ -1,685 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { CodeBlock, CodeBlockCopyButton } from '@docyrus/ui-pro-shared/ai';
|
|
4
|
-
import {
|
|
5
|
-
Source,
|
|
6
|
-
SourcesContent,
|
|
7
|
-
SourcesTrigger,
|
|
8
|
-
Sources
|
|
9
|
-
} from '@docyrus/ui-pro-shared/ai-elements/sources';
|
|
10
|
-
import { Card } from '@docyrus/ui-pro-shared/components/card';
|
|
11
|
-
|
|
12
|
-
import { useAssistantTranslation } from '../i18n';
|
|
13
|
-
import { type ToolActionEvent } from '../types';
|
|
14
|
-
|
|
15
|
-
import { CreateAgentTask } from './create-agent-task';
|
|
16
|
-
import { CreateNewWorkVersion } from './create-new-work-version';
|
|
17
|
-
import { ExtractWeb } from './extract-web';
|
|
18
|
-
import { ForwardToAgent } from './forward-to-agent';
|
|
19
|
-
import { GenerateChart } from './generate-chart';
|
|
20
|
-
import { GenerativeActionButton } from './generative-action-button';
|
|
21
|
-
import { MermaidDiagram } from './mermaid-diagram';
|
|
22
|
-
import PreviewImage from './preview-image';
|
|
23
|
-
import { RequestApproval } from './request-approval';
|
|
24
|
-
import { RequestUserInput } from './request-user-input';
|
|
25
|
-
import { SheetCommand } from './sheet-command';
|
|
26
|
-
import { ShowAdvancedDataTable } from './show-advanced-data-table';
|
|
27
|
-
import { SearchWeb } from './search-web';
|
|
28
|
-
import { ShowGeneratedContentOptions } from './show-generated-content-options';
|
|
29
|
-
import { ShowPeopleCards } from './show-people-cards';
|
|
30
|
-
import { SubagentTool } from './subagent-tool';
|
|
31
|
-
import { TextEditorTool } from './text-editor-tool';
|
|
32
|
-
import { WorkCanvas } from './work-canvas';
|
|
33
|
-
|
|
34
|
-
interface Part {
|
|
35
|
-
state:
|
|
36
|
-
| 'input-available'
|
|
37
|
-
| 'input-streaming'
|
|
38
|
-
| 'output-available'
|
|
39
|
-
| 'output-error'
|
|
40
|
-
| 'approval-requested'
|
|
41
|
-
| 'approval-responded'
|
|
42
|
-
| 'output-denied';
|
|
43
|
-
input?: Record<string, any>;
|
|
44
|
-
output?: any;
|
|
45
|
-
errorText?: string;
|
|
46
|
-
toolCallId: string;
|
|
47
|
-
approval?:
|
|
48
|
-
| { id: string; approved?: never; reason?: never }
|
|
49
|
-
| { id: string; approved: true; reason?: string }
|
|
50
|
-
| { id: string; approved: false; reason?: string };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface GenerativeUIToolProps {
|
|
54
|
-
part: Part;
|
|
55
|
-
toolName: string;
|
|
56
|
-
onToolAction: (event: ToolActionEvent) => void;
|
|
57
|
-
openCanvasView?: (options: {
|
|
58
|
-
type: string;
|
|
59
|
-
id: string;
|
|
60
|
-
versionId?: string;
|
|
61
|
-
title?: string;
|
|
62
|
-
description?: string;
|
|
63
|
-
images?: any[];
|
|
64
|
-
contentJson?: Record<string, any> | null;
|
|
65
|
-
loaded?: boolean;
|
|
66
|
-
workId?: string;
|
|
67
|
-
commands?: any[];
|
|
68
|
-
fetchLatestVersion?: boolean;
|
|
69
|
-
[key: string]: any;
|
|
70
|
-
}) => void;
|
|
71
|
-
onUseWorkResult?: (data: {
|
|
72
|
-
workId?: string;
|
|
73
|
-
workVersionId?: string;
|
|
74
|
-
workType?: string;
|
|
75
|
-
data?: any;
|
|
76
|
-
}) => void;
|
|
77
|
-
onSendSpreadsheetCommands?: (commands: any[]) => void;
|
|
78
|
-
onForwardToAgent?: (options: { agentId: string; prompt?: string }) => void;
|
|
79
|
-
onInsertText?: (data: { text: string }) => void;
|
|
80
|
-
onReplaceText?: (data: { text: string }) => void;
|
|
81
|
-
workId?: string;
|
|
82
|
-
agent?: Record<string, any>;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const stringify = (val: any): string => {
|
|
86
|
-
try {
|
|
87
|
-
return typeof val === 'string' ? val : JSON.stringify(val, null, 2);
|
|
88
|
-
} catch {
|
|
89
|
-
return String(val ?? '');
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export function GenerativeUITool({
|
|
94
|
-
part, toolName, onToolAction, openCanvasView, onUseWorkResult, onSendSpreadsheetCommands, onForwardToAgent, onInsertText, onReplaceText, workId, agent
|
|
95
|
-
}: GenerativeUIToolProps) {
|
|
96
|
-
const { t } = useAssistantTranslation();
|
|
97
|
-
|
|
98
|
-
const emitToolAction = (decision: string) => {
|
|
99
|
-
onToolAction({
|
|
100
|
-
tool: toolName,
|
|
101
|
-
toolCallId: part.toolCallId,
|
|
102
|
-
decision,
|
|
103
|
-
input: part.input
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// requestApproval tool
|
|
108
|
-
if (toolName === 'requestApproval') {
|
|
109
|
-
return (
|
|
110
|
-
<div className="not-prose mb-4 w-full">
|
|
111
|
-
<RequestApproval
|
|
112
|
-
state={part.state}
|
|
113
|
-
action={part.input?.action}
|
|
114
|
-
details={part.input?.details}
|
|
115
|
-
onApprove={() => emitToolAction('approve')}
|
|
116
|
-
onReject={() => emitToolAction('continue')} />
|
|
117
|
-
</div>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// previewCode tool
|
|
122
|
-
if (
|
|
123
|
-
toolName === 'previewCode'
|
|
124
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
125
|
-
) {
|
|
126
|
-
return (
|
|
127
|
-
<div className="not-prose mb-4 w-full">
|
|
128
|
-
<Card
|
|
129
|
-
className="p-4 cursor-pointer hover:bg-accent/50 transition-colors"
|
|
130
|
-
onClick={() => openCanvasView?.({
|
|
131
|
-
type: 'code',
|
|
132
|
-
id: part.output?.id || '',
|
|
133
|
-
title: part.input?.title,
|
|
134
|
-
description: part.input?.description
|
|
135
|
-
})}>
|
|
136
|
-
<h3 className="font-semibold text-sm mb-2">{part.input?.title || t('descriptions.code_preview')}</h3>
|
|
137
|
-
{part.input?.description && <p className="text-xs text-muted-foreground mb-2">{part.input?.description}</p>}
|
|
138
|
-
<div className="text-xs text-muted-foreground">{t('messages.click_to_view_code')} →</div>
|
|
139
|
-
</Card>
|
|
140
|
-
</div>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// generateImage/previewImage tool
|
|
145
|
-
if (
|
|
146
|
-
toolName === 'generateImage'
|
|
147
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
148
|
-
) {
|
|
149
|
-
// Handle completed state with images
|
|
150
|
-
if (part.state === 'output-available' && part.output?.status === 'success' && part.output?.result?.images) {
|
|
151
|
-
return (
|
|
152
|
-
<div className="not-prose mb-4 w-full">
|
|
153
|
-
<PreviewImage
|
|
154
|
-
title={part.input?.prompt}
|
|
155
|
-
images={part.output.result.images}
|
|
156
|
-
onOpen={() => openCanvasView?.({
|
|
157
|
-
type: 'image',
|
|
158
|
-
id: part.output.result.workId || part.output.result.id || '',
|
|
159
|
-
title: part.input?.prompt,
|
|
160
|
-
images: part.output.result.images
|
|
161
|
-
})} />
|
|
162
|
-
</div>
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Loading state (input-streaming, input-available, or output loading)
|
|
167
|
-
return (
|
|
168
|
-
<div className="not-prose mb-4 w-full">
|
|
169
|
-
<div className="rounded-lg border bg-card p-3">
|
|
170
|
-
<div className="text-xs font-medium text-muted-foreground mb-1">{t('messages.generating_image')}</div>
|
|
171
|
-
<div className="text-sm">{part.output?.text || t('messages.generating_image_message')}</div>
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// showImage tool
|
|
178
|
-
if (
|
|
179
|
-
toolName === 'showImage'
|
|
180
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
181
|
-
) {
|
|
182
|
-
return (
|
|
183
|
-
<div className="not-prose mb-4 w-full">
|
|
184
|
-
<PreviewImage
|
|
185
|
-
title={part.input?.title}
|
|
186
|
-
images={part.input?.images} />
|
|
187
|
-
</div>
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// showAdvancedDataTable tool
|
|
192
|
-
if (toolName === 'showAdvancedDataTable') {
|
|
193
|
-
return (
|
|
194
|
-
<div className="not-prose mb-4 w-full">
|
|
195
|
-
<ShowAdvancedDataTable
|
|
196
|
-
state={part.state}
|
|
197
|
-
errorText={part.errorText}
|
|
198
|
-
title={part.input?.title}
|
|
199
|
-
description={part.input?.description}
|
|
200
|
-
additionalComments={part.input?.additionalComments}
|
|
201
|
-
data={part.input?.data}
|
|
202
|
-
columns={part.input?.columns}
|
|
203
|
-
enableTree={part.input?.enableTree}
|
|
204
|
-
treeChildrenField={part.input?.treeChildrenField} />
|
|
205
|
-
</div>
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// record form tools
|
|
210
|
-
if (
|
|
211
|
-
toolName === 'showCreateRecordForm'
|
|
212
|
-
|| toolName === 'showUpdateRecordForm'
|
|
213
|
-
|| toolName === 'showRecordDetailsForm'
|
|
214
|
-
) {
|
|
215
|
-
const recordMode = toolName === 'showCreateRecordForm' ? 'add' : toolName === 'showUpdateRecordForm' ? 'edit' : 'view';
|
|
216
|
-
|
|
217
|
-
const dataSourceId = part.input?.dataSourceId
|
|
218
|
-
|| part.output?.result?.dataSourceId;
|
|
219
|
-
|
|
220
|
-
const recordDefaultValues = part.input?.defaultValues
|
|
221
|
-
|| part.output?.result?.defaultValues;
|
|
222
|
-
|
|
223
|
-
const recordId = part.input?.recordId || part.output?.result?.recordId;
|
|
224
|
-
|
|
225
|
-
return (
|
|
226
|
-
<div className="not-prose mb-4 w-full">
|
|
227
|
-
<GenerativeActionButton
|
|
228
|
-
action={toolName}
|
|
229
|
-
data={part.input}
|
|
230
|
-
title={part.output?.text}
|
|
231
|
-
icon={part.output?.icon}
|
|
232
|
-
onAction={(action, data) => {
|
|
233
|
-
openCanvasView?.({
|
|
234
|
-
type: 'record',
|
|
235
|
-
id: `record-${Date.now()}`,
|
|
236
|
-
title: part.output?.text || action,
|
|
237
|
-
dataSourceId,
|
|
238
|
-
data: recordDefaultValues,
|
|
239
|
-
mode: recordMode,
|
|
240
|
-
recordId
|
|
241
|
-
} as any);
|
|
242
|
-
onToolAction({
|
|
243
|
-
tool: action,
|
|
244
|
-
toolCallId: part.toolCallId,
|
|
245
|
-
decision: 'open',
|
|
246
|
-
input: data
|
|
247
|
-
});
|
|
248
|
-
}} />
|
|
249
|
-
</div>
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// previewMermaidDiagram tool
|
|
254
|
-
if (toolName === 'previewMermaidDiagram') {
|
|
255
|
-
return (
|
|
256
|
-
<div className="not-prose mb-4 w-full">
|
|
257
|
-
<MermaidDiagram
|
|
258
|
-
title={part.output?.text ?? part.input?.title}
|
|
259
|
-
description={part.input?.description}
|
|
260
|
-
mermaidNotation={part.input?.mermaidNotation ?? ''}
|
|
261
|
-
state={part.state} />
|
|
262
|
-
</div>
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// generateChart tool
|
|
267
|
-
if (toolName === 'generateChart') {
|
|
268
|
-
return (
|
|
269
|
-
<div className="not-prose mb-4 w-full">
|
|
270
|
-
<GenerateChart
|
|
271
|
-
spec={part.output?.result?.spec}
|
|
272
|
-
time={part.output?.result?.time}
|
|
273
|
-
state={part.state}
|
|
274
|
-
errorText={part.errorText}
|
|
275
|
-
title={part.output?.text ?? part.input?.title}
|
|
276
|
-
description={part.input?.description} />
|
|
277
|
-
</div>
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
// saveTextWork tool
|
|
282
|
-
if (
|
|
283
|
-
toolName === 'saveTextWork'
|
|
284
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
285
|
-
) {
|
|
286
|
-
return (
|
|
287
|
-
<div className="not-prose mb-4 w-full">
|
|
288
|
-
<WorkCanvas
|
|
289
|
-
title={part.output?.text || part.input?.title}
|
|
290
|
-
description={part.input?.description}
|
|
291
|
-
id={part.output?.result?.workId || ''}
|
|
292
|
-
content={part.input?.content || ''}
|
|
293
|
-
state={part.state}
|
|
294
|
-
onOpen={() => openCanvasView?.({
|
|
295
|
-
type: 'text',
|
|
296
|
-
id: part.output?.result?.workId || '',
|
|
297
|
-
versionId: part.output?.result?.workVersionId || '',
|
|
298
|
-
title: part.input?.title,
|
|
299
|
-
description: part.input?.description
|
|
300
|
-
})} />
|
|
301
|
-
</div>
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// showWorkCanvas tool
|
|
306
|
-
if (
|
|
307
|
-
toolName === 'showWorkCanvas'
|
|
308
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
309
|
-
) {
|
|
310
|
-
return (
|
|
311
|
-
<div className="not-prose mb-4 w-full">
|
|
312
|
-
<WorkCanvas
|
|
313
|
-
title={part.output?.text || part.input?.title}
|
|
314
|
-
description={part.input?.description}
|
|
315
|
-
id={part.input?.workId || ''}
|
|
316
|
-
state={part.state}
|
|
317
|
-
showUseButton={!!onUseWorkResult}
|
|
318
|
-
onOpen={() => openCanvasView?.({
|
|
319
|
-
type: part.input?.workType || 'code',
|
|
320
|
-
id: part.input?.workId || '',
|
|
321
|
-
versionId: part.input?.workVersionId || '',
|
|
322
|
-
title: part.input?.title,
|
|
323
|
-
description: part.input?.description
|
|
324
|
-
})}
|
|
325
|
-
onUseResult={() => onUseWorkResult?.({
|
|
326
|
-
workId: part.input?.workId,
|
|
327
|
-
workVersionId: part.input?.workVersionId,
|
|
328
|
-
workType: part.input?.workType || 'code',
|
|
329
|
-
data: part.input
|
|
330
|
-
})} />
|
|
331
|
-
</div>
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
// searchWeb / web_search / google_search / browser_search tools
|
|
336
|
-
if (
|
|
337
|
-
toolName === 'searchWeb'
|
|
338
|
-
|| toolName === 'web_search'
|
|
339
|
-
|| toolName === 'google_search'
|
|
340
|
-
|| toolName === 'browser_search'
|
|
341
|
-
) {
|
|
342
|
-
if (part.state === 'input-available' || part.state === 'input-streaming') {
|
|
343
|
-
return (
|
|
344
|
-
<div className="not-prose mb-4 w-full">
|
|
345
|
-
<div className="rounded-lg border bg-card p-3 flex items-center gap-2">
|
|
346
|
-
<span className="text-xs font-medium text-slate-500">
|
|
347
|
-
{part.output?.text || 'Searching the web...'}
|
|
348
|
-
</span>
|
|
349
|
-
</div>
|
|
350
|
-
</div>
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
return (
|
|
355
|
-
<div className="not-prose mb-4 w-full">
|
|
356
|
-
<SearchWeb
|
|
357
|
-
state={part.state}
|
|
358
|
-
output={part.output}
|
|
359
|
-
errorText={part.errorText}
|
|
360
|
-
title={part.output?.text} />
|
|
361
|
-
</div>
|
|
362
|
-
);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// extractFromWeb tool
|
|
366
|
-
if (
|
|
367
|
-
toolName === 'extractFromWeb'
|
|
368
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
369
|
-
) {
|
|
370
|
-
return (
|
|
371
|
-
<div className="not-prose mb-4 w-full">
|
|
372
|
-
<ExtractWeb
|
|
373
|
-
title={part.output?.text || part.output?.result?.title || part.input?.title}
|
|
374
|
-
status={part.output?.result?.status || part.output?.status}
|
|
375
|
-
state={part.state}
|
|
376
|
-
runId={part.output?.result?.runId || part.output?.result?.extractionId}
|
|
377
|
-
onOpen={() => openCanvasView?.({
|
|
378
|
-
type: 'data',
|
|
379
|
-
id: part.output?.result?.workId || 'streaming',
|
|
380
|
-
versionId: part.output?.result?.workVersionId || 'streaming',
|
|
381
|
-
contentJson: {
|
|
382
|
-
basis: part.output?.result?.data?.output?.basis,
|
|
383
|
-
content: part.output?.result?.data?.output?.content
|
|
384
|
-
},
|
|
385
|
-
loaded: true
|
|
386
|
-
} as any)} />
|
|
387
|
-
</div>
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// deepResearch tool
|
|
392
|
-
if (
|
|
393
|
-
toolName === 'deepResearch'
|
|
394
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
395
|
-
) {
|
|
396
|
-
if (part.state === 'input-available' || part.state === 'input-streaming') {
|
|
397
|
-
return (
|
|
398
|
-
<div className="not-prose mb-4 w-full">
|
|
399
|
-
<div className="rounded-lg border bg-card p-3 flex items-center gap-2">
|
|
400
|
-
<span className="text-xs font-medium text-slate-500">
|
|
401
|
-
{part.output?.text || `${t('tools.deep_research')}...`}
|
|
402
|
-
</span>
|
|
403
|
-
</div>
|
|
404
|
-
</div>
|
|
405
|
-
);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
return (
|
|
409
|
-
<div className="not-prose mb-4 w-full">
|
|
410
|
-
<Card
|
|
411
|
-
className="p-4 cursor-pointer hover:bg-accent/50 transition-colors"
|
|
412
|
-
onClick={() => openCanvasView?.({
|
|
413
|
-
type: 'data',
|
|
414
|
-
id: part.output?.result?.data?.run?.run_id || part.output?.result?.workId || '',
|
|
415
|
-
title: part.input?.title || part.output?.text || t('tools.deep_research'),
|
|
416
|
-
contentJson: {
|
|
417
|
-
output_schema: part.output?.result?.data?.output?.output_schema || part.input?.output_schema,
|
|
418
|
-
content: part.output?.result?.data?.output?.content,
|
|
419
|
-
basis: part.output?.result?.data?.output?.basis
|
|
420
|
-
},
|
|
421
|
-
loaded: true
|
|
422
|
-
})}>
|
|
423
|
-
<h3 className="font-semibold text-sm mb-2">{part.input?.title || part.output?.text || t('tools.deep_research')}</h3>
|
|
424
|
-
{part.input?.description && <p className="text-xs text-muted-foreground mb-2">{part.input.description}</p>}
|
|
425
|
-
<div className="text-xs text-muted-foreground">{t('messages.click_to_view_code')} →</div>
|
|
426
|
-
</Card>
|
|
427
|
-
</div>
|
|
428
|
-
);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
// requestUserInput tool
|
|
432
|
-
if (
|
|
433
|
-
toolName === 'requestUserInput'
|
|
434
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
435
|
-
) {
|
|
436
|
-
return (
|
|
437
|
-
<div className="not-prose mb-4 w-full">
|
|
438
|
-
<RequestUserInput
|
|
439
|
-
state={part.state}
|
|
440
|
-
schema={part.input?.jsonSchema || {}}
|
|
441
|
-
title={part.input?.title || 'User Input Required'}
|
|
442
|
-
description={part.input?.description || ''}
|
|
443
|
-
submitLabel={part.input?.submitLabel || 'Submit'}
|
|
444
|
-
output={part.output}
|
|
445
|
-
onSubmit={data => onToolAction({
|
|
446
|
-
tool: toolName,
|
|
447
|
-
toolCallId: part.toolCallId,
|
|
448
|
-
decision: 'submit',
|
|
449
|
-
input: data
|
|
450
|
-
})}
|
|
451
|
-
onCancel={() => emitToolAction('cancel')} />
|
|
452
|
-
</div>
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// call*Agent tools (orchestrator subagent calls)
|
|
457
|
-
if (
|
|
458
|
-
toolName.startsWith('call')
|
|
459
|
-
&& toolName.endsWith('Agent')
|
|
460
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
461
|
-
) {
|
|
462
|
-
const output = part.output as Record<string, any> | undefined;
|
|
463
|
-
|
|
464
|
-
return (
|
|
465
|
-
<div className="not-prose mb-4 w-full">
|
|
466
|
-
<SubagentTool
|
|
467
|
-
toolState={part.state}
|
|
468
|
-
input={part.input}
|
|
469
|
-
status={output?.status}
|
|
470
|
-
text={output?.text}
|
|
471
|
-
icon={output?.icon}
|
|
472
|
-
skillName={output?.skillName}
|
|
473
|
-
agentName={output?.agentName}
|
|
474
|
-
step={output?.step}
|
|
475
|
-
result={output?.result}
|
|
476
|
-
agent={agent}
|
|
477
|
-
openCanvasView={openCanvasView} />
|
|
478
|
-
</div>
|
|
479
|
-
);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
// forwardToAgentById tool
|
|
483
|
-
if (
|
|
484
|
-
toolName === 'forwardToAgentById'
|
|
485
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming')
|
|
486
|
-
) {
|
|
487
|
-
return (
|
|
488
|
-
<div className="not-prose mb-4 w-full">
|
|
489
|
-
<ForwardToAgent
|
|
490
|
-
agentId={part.input?.agentId}
|
|
491
|
-
prompt={part.input?.prompt}
|
|
492
|
-
state={part.state}
|
|
493
|
-
onForward={() => {
|
|
494
|
-
onForwardToAgent?.({ agentId: part.input?.agentId, prompt: part.input?.prompt });
|
|
495
|
-
emitToolAction('forward');
|
|
496
|
-
}} />
|
|
497
|
-
</div>
|
|
498
|
-
);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
// runSpreadsheetCommand tool
|
|
502
|
-
if (toolName === 'runSpreadsheetCommand') {
|
|
503
|
-
return (
|
|
504
|
-
<div className="not-prose mb-4 w-full">
|
|
505
|
-
<SheetCommand
|
|
506
|
-
commands={part.input?.commands}
|
|
507
|
-
state={part.state}
|
|
508
|
-
toolCallId={part.toolCallId}
|
|
509
|
-
workId={part.input?.id || workId}
|
|
510
|
-
openCanvasView={openCanvasView}
|
|
511
|
-
onSendSpreadsheetCommands={onSendSpreadsheetCommands}
|
|
512
|
-
onAutoRespond={() => onToolAction({
|
|
513
|
-
tool: toolName,
|
|
514
|
-
toolCallId: part.toolCallId,
|
|
515
|
-
decision: 'submit',
|
|
516
|
-
input: { success: true }
|
|
517
|
-
})} />
|
|
518
|
-
</div>
|
|
519
|
-
);
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
// showPeopleCards tool
|
|
523
|
-
if (
|
|
524
|
-
toolName === 'showPeopleCards'
|
|
525
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
526
|
-
) {
|
|
527
|
-
return (
|
|
528
|
-
<div className="not-prose mb-4 w-full">
|
|
529
|
-
<ShowPeopleCards
|
|
530
|
-
state={part.state}
|
|
531
|
-
output={part.output}
|
|
532
|
-
errorText={part.errorText}
|
|
533
|
-
title={part.output?.text} />
|
|
534
|
-
</div>
|
|
535
|
-
);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
// createAgentTask tool
|
|
539
|
-
if (
|
|
540
|
-
toolName === 'createAgentTask'
|
|
541
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
542
|
-
) {
|
|
543
|
-
return (
|
|
544
|
-
<div className="not-prose mb-4 w-full">
|
|
545
|
-
<CreateAgentTask
|
|
546
|
-
taskPrompt={part.input?.taskPrompt}
|
|
547
|
-
taskDescription={part.input?.taskDescription}
|
|
548
|
-
scheduleType={part.input?.scheduleType}
|
|
549
|
-
state={part.state}
|
|
550
|
-
output={part.output} />
|
|
551
|
-
</div>
|
|
552
|
-
);
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
// showGeneratedContentOptions tool
|
|
556
|
-
if (
|
|
557
|
-
toolName === 'showGeneratedContentOptions'
|
|
558
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available' || part.state === 'output-error')
|
|
559
|
-
) {
|
|
560
|
-
return (
|
|
561
|
-
<div className="not-prose mb-4 w-full">
|
|
562
|
-
<ShowGeneratedContentOptions
|
|
563
|
-
output={part.output?.result}
|
|
564
|
-
state={part.state}
|
|
565
|
-
onInsertText={onInsertText}
|
|
566
|
-
onReplaceText={onReplaceText} />
|
|
567
|
-
</div>
|
|
568
|
-
);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
// createNewWorkVersion tool
|
|
572
|
-
if (toolName === 'createNewWorkVersion') {
|
|
573
|
-
return (
|
|
574
|
-
<div className="not-prose mb-4 w-full">
|
|
575
|
-
<CreateNewWorkVersion
|
|
576
|
-
title={part.output?.text || part.input?.title}
|
|
577
|
-
description={part.input?.description}
|
|
578
|
-
state={part.state} />
|
|
579
|
-
</div>
|
|
580
|
-
);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
// searchDocuments tool
|
|
584
|
-
if (toolName === 'searchDocuments') {
|
|
585
|
-
if (part.state === 'input-available' || part.state === 'input-streaming') {
|
|
586
|
-
return (
|
|
587
|
-
<div className="not-prose mb-4 w-full">
|
|
588
|
-
<div className="rounded-lg border bg-card p-3 flex items-center gap-2">
|
|
589
|
-
<span className="text-xs font-medium text-slate-500">
|
|
590
|
-
{part.output?.text || t('tools.document_search')}
|
|
591
|
-
</span>
|
|
592
|
-
</div>
|
|
593
|
-
</div>
|
|
594
|
-
);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
if (part.state === 'output-available') {
|
|
598
|
-
const sources: Array<{ url: string; title?: string }> = part.output?.result?.sources ?? [];
|
|
599
|
-
|
|
600
|
-
if (sources.length > 0) {
|
|
601
|
-
return (
|
|
602
|
-
<div className="not-prose mb-4 w-full">
|
|
603
|
-
<Sources>
|
|
604
|
-
<SourcesTrigger count={sources.length}>
|
|
605
|
-
<span className="font-medium">{part.output?.text || `${sources.length} sources`}</span>
|
|
606
|
-
</SourcesTrigger>
|
|
607
|
-
<SourcesContent>
|
|
608
|
-
{sources.map((src, idx) => (
|
|
609
|
-
<Source key={idx} href={src.url} title={src.title || src.url} />
|
|
610
|
-
))}
|
|
611
|
-
</SourcesContent>
|
|
612
|
-
</Sources>
|
|
613
|
-
</div>
|
|
614
|
-
);
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
return (
|
|
618
|
-
<div className="not-prose mb-4 w-full">
|
|
619
|
-
<div className="rounded-lg border bg-card p-3">
|
|
620
|
-
<span className="text-xs font-medium text-slate-500">No documents found</span>
|
|
621
|
-
</div>
|
|
622
|
-
</div>
|
|
623
|
-
);
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
// str_replace_based_edit_tool
|
|
628
|
-
if (
|
|
629
|
-
toolName === 'str_replace_based_edit_tool'
|
|
630
|
-
&& (part.state === 'input-available' || part.state === 'input-streaming' || part.state === 'output-available')
|
|
631
|
-
) {
|
|
632
|
-
const output = part.output as any;
|
|
633
|
-
|
|
634
|
-
return (
|
|
635
|
-
<div className="not-prose mb-4 w-full">
|
|
636
|
-
<TextEditorTool
|
|
637
|
-
command={part.input?.command || 'view'}
|
|
638
|
-
path={part.input?.path || ''}
|
|
639
|
-
fileText={part.input?.file_text || ''}
|
|
640
|
-
oldStr={part.input?.old_str || ''}
|
|
641
|
-
newStr={part.input?.new_str || ''}
|
|
642
|
-
insertLine={part.input?.insert_line || 0}
|
|
643
|
-
viewRange={part.input?.view_range || null}
|
|
644
|
-
query={part.input?.query || ''}
|
|
645
|
-
state={part.state}
|
|
646
|
-
result={output?.result ?? output ?? null}
|
|
647
|
-
errorText={part.errorText}
|
|
648
|
-
onOpen={() => openCanvasView?.({
|
|
649
|
-
type: output?.type || 'code',
|
|
650
|
-
id: output?.workId || '',
|
|
651
|
-
versionId: output?.workVersionId || '',
|
|
652
|
-
title: part.input?.path
|
|
653
|
-
})} />
|
|
654
|
-
</div>
|
|
655
|
-
);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
if (part.state === 'output-available') {
|
|
659
|
-
return (
|
|
660
|
-
<div className="not-prose mb-4 w-full">
|
|
661
|
-
<div className="rounded-lg border bg-card p-3">
|
|
662
|
-
<div className="text-xs font-medium text-muted-foreground mb-1">{t('sections.output')}</div>
|
|
663
|
-
<CodeBlock code={stringify(part.output)} language="json">
|
|
664
|
-
<CodeBlockCopyButton />
|
|
665
|
-
</CodeBlock>
|
|
666
|
-
</div>
|
|
667
|
-
</div>
|
|
668
|
-
);
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
if (part.state === 'output-error') {
|
|
672
|
-
return (
|
|
673
|
-
<div className="not-prose mb-4 w-full">
|
|
674
|
-
<div className="rounded-lg border bg-card p-3">
|
|
675
|
-
<div className="text-xs font-medium text-destructive mb-1">{t('sections.error')}</div>
|
|
676
|
-
<CodeBlock code={part.errorText || ''} language={'txt' as any}>
|
|
677
|
-
<CodeBlockCopyButton />
|
|
678
|
-
</CodeBlock>
|
|
679
|
-
</div>
|
|
680
|
-
</div>
|
|
681
|
-
);
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
return null;
|
|
685
|
-
}
|