@docyrus/ui-pro-ai-assistant 0.5.0 → 0.5.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 +1 -0
- package/dist/docy-assistant.d.ts +1 -1
- package/dist/index.js +199 -56
- package/dist/index.js.map +1 -1
- package/dist/lib/message-utils.d.ts +1 -0
- package/dist/styles.css +3 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/views/assistant-view.d.ts +1 -0
- package/dist/views/chat-panel.d.ts +2 -1
- package/dist/views/message-list.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext, memo, useMemo, useEffect,
|
|
1
|
+
import { createContext, memo, useState, useCallback, useMemo, useEffect, useRef, use, useLayoutEffect, startTransition, Fragment as Fragment$1, useSyncExternalStore, useId, useReducer, useImperativeHandle, Component } from 'react';
|
|
2
2
|
import { useChat as useChat$1 } from '@ai-sdk/react';
|
|
3
3
|
import { Button } from '@docyrus/ui-pro-shared/components/button';
|
|
4
4
|
import { toast, Toaster } from 'sonner';
|
|
@@ -9,14 +9,14 @@ import { Input } from '@docyrus/ui-pro-shared/components/input';
|
|
|
9
9
|
import { Tabs as Tabs$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1, TabsContent as TabsContent$1 } from '@docyrus/ui-pro-shared/components/tabs';
|
|
10
10
|
import { cn } from '@docyrus/ui-pro-shared/lib/utils';
|
|
11
11
|
import { DefaultChatTransport, lastAssistantMessageIsCompleteWithToolCalls } from 'ai';
|
|
12
|
-
import { PilcrowIcon, Heading1Icon, Heading2Icon, Heading3Icon, SquareIcon, ListIcon, ListOrderedIcon, ChevronDownIcon, Code2Icon, QuoteIcon, LightbulbIcon, Columns3Icon, GripVertical, FileUpIcon, TableIcon, ImageIcon, FilmIcon, AudioLinesIcon, TableOfContentsIcon, RadicalIcon, RectangleVerticalIcon, CalendarIcon, PlusIcon, FileCodeIcon, MinusIcon, ChevronRightIcon, ListTree, PenToolIcon, Link2Icon, Check, Copy, FilesIcon, Link, Text, ExternalLink, Unlink, Bold, Italic, Underline, Strikethrough, Code2, MoreHorizontal, ArrowLeftIcon, ArrowRightIcon, Minus, Plus, CircleArrowDown, Minimize2, Trash2, FileUp, CheckCircle2, FileText, Loader2, CornerDownLeftIcon, PencilLineIcon, MessageSquareTextIcon, MessagesSquareIcon, ArrowUpIcon, CheckIcon, CaptionsIcon, ZoomInIcon, CircleArrowDownIcon, MoveUpRightIcon, MoreHorizontalIcon, Eye,
|
|
12
|
+
import { Pencil, PilcrowIcon, Heading1Icon, Heading2Icon, Heading3Icon, SquareIcon, ListIcon, ListOrderedIcon, ChevronDownIcon, Code2Icon, QuoteIcon, LightbulbIcon, Columns3Icon, GripVertical, FileUpIcon, TableIcon, ImageIcon, FilmIcon, AudioLinesIcon, TableOfContentsIcon, RadicalIcon, RectangleVerticalIcon, CalendarIcon, PlusIcon, FileCodeIcon, MinusIcon, ChevronRightIcon, ListTree, PenToolIcon, Link2Icon, Check, X, Copy, FilesIcon, Link, Text, ExternalLink, Unlink, Bold, Italic, Underline, Strikethrough, Code2, MoreHorizontal, ArrowLeftIcon, ArrowRightIcon, Minus, Plus, CircleArrowDown, Minimize2, Trash2, FileUp, CheckCircle2, FileText, Loader2, CornerDownLeftIcon, PencilLineIcon, MessageSquareTextIcon, MessagesSquareIcon, ArrowUpIcon, CheckIcon, CaptionsIcon, ZoomInIcon, CircleArrowDownIcon, MoveUpRightIcon, MoreHorizontalIcon, Eye, PlusCircle, HelpCircle, Maximize2, Download, FileSpreadsheet, ChevronDown, ChevronLeft, ChevronRight, CheckCircle, XCircle, Search, Globe, FolderOpen, User, ArrowRight, MapPin, CalendarClock, List, RefreshCw, FilePlus, XIcon, CornerUpLeftIcon, AlbumIcon, FeatherIcon, ListMinusIcon, ListPlusIcon, ListEnd, Wand, LanguagesIcon, BadgeHelpIcon, PenLineIcon, SearchIcon, MusicIcon, CompassIcon, SmileIcon, LeafIcon, ClockIcon, AppleIcon, FlagIcon, StarIcon, DeleteIcon, AlignLeft, AlignCenter, AlignRight, RotateCcw, AlertTriangle, AlertCircle, ArrowUpDown, ArrowDownToLine, PenLine, PencilIcon, TrashIcon, FileIcon, Star, ChevronsUpDown, FolderIcon, MessageSquare, Hash, Table, CheckSquare, Calendar as Calendar$1, Clock, Phone, Mail, Send, RefreshCcw, Undo2, ChevronsUpDownIcon, ChevronsRight, ChevronsLeft, CalendarDays, RefreshCwIcon, PaintRoller, MessageSquareText, ArrowLeft, Users, Bot, Brain, Lightbulb, BookOpen, PenTool, SlidersHorizontal, Wand2, Mic, Code, Trash, Edit, Share, FolderInput, Archive, Building2, ShieldCheck, Sparkles, PanelLeft, NotebookText, CirclePlus, MoreVertical, FileSearch, Microscope, Ruler, AudioLines, BrainCircuit, File as File$1, Plug, Inbox, Menu, LayoutDashboard, Table2, WandSparklesIcon, ArrowUpToLineIcon, BoldIcon, ItalicIcon, UnderlineIcon, StrikethroughIcon, HighlighterIcon, Undo2Icon, Redo2Icon, ArrowDownToLineIcon, AlignLeftIcon, AlignCenterIcon, AlignRightIcon, AlignJustifyIcon, ListOrdered, ListTodoIcon, ListCollapseIcon, Grid3x3Icon, Combine, Ungroup, ArrowUp, ArrowDown, Trash2Icon, LinkIcon, WrapText, OutdentIcon, IndentIcon, EyeIcon, PenIcon } from 'lucide-react';
|
|
13
13
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
14
|
import { ScrollArea as ScrollArea$1 } from '@docyrus/ui-pro-shared/components/scroll-area';
|
|
15
15
|
import { AsyncTokenManager, RestApiClient } from '@docyrus/api-client';
|
|
16
16
|
import { TooltipProvider as TooltipProvider$1, Tooltip as Tooltip$2, TooltipTrigger as TooltipTrigger$1, TooltipContent as TooltipContent$1 } from '@docyrus/ui-pro-shared/components/tooltip';
|
|
17
17
|
import { createPortal } from 'react-dom';
|
|
18
18
|
import { Avatar as Avatar$1, AvatarImage as AvatarImage$1, AvatarFallback as AvatarFallback$1 } from '@docyrus/ui-pro-shared/components/avatar';
|
|
19
|
-
import { Message, AIMessageAvatar, MessageContent, MessageActions, AIConversation, AIConversationContent, MessageResponse, AIConversationScrollButton,
|
|
19
|
+
import { Message, AIMessageAvatar, MessageContent, MessageActions, MessageAction, AIConversation, AIConversationContent, MessageResponse, AIConversationScrollButton, Tool, ToolHeader, ToolContent, ToolInput, ToolOutput, CodeBlock, CodeBlockCopyButton, resolveToolIcon, PromptInputButton, PromptInput, PromptInputTextarea, PromptInputFooter, PromptInputTools, PromptInputSubmit, usePromptInputAttachments } from '@docyrus/ui-pro-shared/ai';
|
|
20
20
|
import { Spinner } from '@docyrus/ui-pro-shared/components/spinner';
|
|
21
21
|
import { Badge as Badge$1 } from '@docyrus/ui-pro-shared/components/badge';
|
|
22
22
|
import { DotLottieReact } from '@lottiefiles/dotlottie-react';
|
|
@@ -496,7 +496,10 @@ var de_default = {
|
|
|
496
496
|
start_recording: "Aufnahme starten",
|
|
497
497
|
stop_recording: "Aufnahme stoppen",
|
|
498
498
|
optimize_prompt: "Eingabe optimieren",
|
|
499
|
-
retry: "Erneut versuchen"
|
|
499
|
+
retry: "Erneut versuchen",
|
|
500
|
+
save_changes: "\xC4nderungen speichern",
|
|
501
|
+
cancel: "Abbrechen",
|
|
502
|
+
edit_prompt: "Eingabe bearbeiten"
|
|
500
503
|
},
|
|
501
504
|
actions: {
|
|
502
505
|
approve: "Genehmigen",
|
|
@@ -725,7 +728,10 @@ var el_default = {
|
|
|
725
728
|
start_recording: "\u0388\u03BD\u03B1\u03C1\u03BE\u03B7 \u03B5\u03B3\u03B3\u03C1\u03B1\u03C6\u03AE\u03C2",
|
|
726
729
|
stop_recording: "\u0394\u03B9\u03B1\u03BA\u03BF\u03C0\u03AE \u03B5\u03B3\u03B3\u03C1\u03B1\u03C6\u03AE\u03C2",
|
|
727
730
|
optimize_prompt: "\u0392\u03B5\u03BB\u03C4\u03B9\u03C3\u03C4\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7 \u03B5\u03BD\u03C4\u03BF\u03BB\u03AE\u03C2",
|
|
728
|
-
retry: "\u0395\u03C0\u03B1\u03BD\u03AC\u03BB\u03B7\u03C8\u03B7"
|
|
731
|
+
retry: "\u0395\u03C0\u03B1\u03BD\u03AC\u03BB\u03B7\u03C8\u03B7",
|
|
732
|
+
save_changes: "\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7 \u03B1\u03BB\u03BB\u03B1\u03B3\u03CE\u03BD",
|
|
733
|
+
cancel: "\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7",
|
|
734
|
+
edit_prompt: "\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 \u03B5\u03BD\u03C4\u03BF\u03BB\u03AE\u03C2"
|
|
729
735
|
},
|
|
730
736
|
actions: {
|
|
731
737
|
approve: "\u0388\u03B3\u03BA\u03C1\u03B9\u03C3\u03B7",
|
|
@@ -955,7 +961,10 @@ var en_default = {
|
|
|
955
961
|
start_recording: "Start Recording",
|
|
956
962
|
stop_recording: "Stop Recording",
|
|
957
963
|
optimize_prompt: "Optimize Prompt",
|
|
958
|
-
retry: "Retry"
|
|
964
|
+
retry: "Retry",
|
|
965
|
+
save_changes: "Save Changes",
|
|
966
|
+
cancel: "Cancel",
|
|
967
|
+
edit_prompt: "Edit Prompt"
|
|
959
968
|
},
|
|
960
969
|
actions: {
|
|
961
970
|
approve: "Approve",
|
|
@@ -1211,7 +1220,10 @@ var es_default = {
|
|
|
1211
1220
|
start_recording: "Iniciar grabaci\xF3n",
|
|
1212
1221
|
stop_recording: "Detener grabaci\xF3n",
|
|
1213
1222
|
optimize_prompt: "Optimizar instrucci\xF3n",
|
|
1214
|
-
retry: "Reintentar"
|
|
1223
|
+
retry: "Reintentar",
|
|
1224
|
+
save_changes: "Guardar cambios",
|
|
1225
|
+
cancel: "Cancelar",
|
|
1226
|
+
edit_prompt: "Editar instrucci\xF3n"
|
|
1215
1227
|
},
|
|
1216
1228
|
actions: {
|
|
1217
1229
|
approve: "Aprobar",
|
|
@@ -1440,7 +1452,10 @@ var fr_default = {
|
|
|
1440
1452
|
start_recording: "D\xE9marrer l'enregistrement",
|
|
1441
1453
|
stop_recording: "Arr\xEAter l'enregistrement",
|
|
1442
1454
|
optimize_prompt: "Optimiser l'instruction",
|
|
1443
|
-
retry: "R\xE9essayer"
|
|
1455
|
+
retry: "R\xE9essayer",
|
|
1456
|
+
save_changes: "Enregistrer les modifications",
|
|
1457
|
+
cancel: "Annuler",
|
|
1458
|
+
edit_prompt: "Modifier l'instruction"
|
|
1444
1459
|
},
|
|
1445
1460
|
actions: {
|
|
1446
1461
|
approve: "Approuver",
|
|
@@ -1669,7 +1684,10 @@ var it_default = {
|
|
|
1669
1684
|
start_recording: "Avvia registrazione",
|
|
1670
1685
|
stop_recording: "Interrompi registrazione",
|
|
1671
1686
|
optimize_prompt: "Ottimizza prompt",
|
|
1672
|
-
retry: "Riprova"
|
|
1687
|
+
retry: "Riprova",
|
|
1688
|
+
save_changes: "Salva modifiche",
|
|
1689
|
+
cancel: "Annulla",
|
|
1690
|
+
edit_prompt: "Modifica prompt"
|
|
1673
1691
|
},
|
|
1674
1692
|
actions: {
|
|
1675
1693
|
approve: "Approva",
|
|
@@ -1898,7 +1916,10 @@ var pt_default = {
|
|
|
1898
1916
|
start_recording: "Iniciar grava\xE7\xE3o",
|
|
1899
1917
|
stop_recording: "Parar grava\xE7\xE3o",
|
|
1900
1918
|
optimize_prompt: "Otimizar instru\xE7\xE3o",
|
|
1901
|
-
retry: "Tentar novamente"
|
|
1919
|
+
retry: "Tentar novamente",
|
|
1920
|
+
save_changes: "Salvar altera\xE7\xF5es",
|
|
1921
|
+
cancel: "Cancelar",
|
|
1922
|
+
edit_prompt: "Editar instru\xE7\xE3o"
|
|
1902
1923
|
},
|
|
1903
1924
|
actions: {
|
|
1904
1925
|
approve: "Aprovar",
|
|
@@ -2127,7 +2148,10 @@ var sl_default = {
|
|
|
2127
2148
|
start_recording: "Za\u010Dni snemanje",
|
|
2128
2149
|
stop_recording: "Ustavi snemanje",
|
|
2129
2150
|
optimize_prompt: "Optimiziraj ukaz",
|
|
2130
|
-
retry: "Poskusi znova"
|
|
2151
|
+
retry: "Poskusi znova",
|
|
2152
|
+
save_changes: "Shrani spremembe",
|
|
2153
|
+
cancel: "Prekli\u010Di",
|
|
2154
|
+
edit_prompt: "Uredi ukaz"
|
|
2131
2155
|
},
|
|
2132
2156
|
actions: {
|
|
2133
2157
|
approve: "Odobri",
|
|
@@ -2357,7 +2381,10 @@ var tr_default = {
|
|
|
2357
2381
|
start_recording: "Kayda Ba\u015Fla",
|
|
2358
2382
|
stop_recording: "Kayd\u0131 Durdur",
|
|
2359
2383
|
optimize_prompt: "Komutu Optimize Et",
|
|
2360
|
-
retry: "Tekrar Dene"
|
|
2384
|
+
retry: "Tekrar Dene",
|
|
2385
|
+
save_changes: "De\u011Fi\u015Fiklikleri Kaydet",
|
|
2386
|
+
cancel: "\u0130ptal",
|
|
2387
|
+
edit_prompt: "Komutu D\xFCzenle"
|
|
2361
2388
|
},
|
|
2362
2389
|
actions: {
|
|
2363
2390
|
approve: "Onayla",
|
|
@@ -2880,7 +2907,7 @@ function processMessagesData(rawData) {
|
|
|
2880
2907
|
}
|
|
2881
2908
|
}
|
|
2882
2909
|
return {
|
|
2883
|
-
id: messageData.id || `msg-${index}`,
|
|
2910
|
+
id: messageData.message_id || messageData.id || `msg-${index}`,
|
|
2884
2911
|
role,
|
|
2885
2912
|
content,
|
|
2886
2913
|
// Add content field for easy access
|
|
@@ -3054,8 +3081,10 @@ async function fetchWorks(apiClient, onSuccess, tenantAiAgentId, userId) {
|
|
|
3054
3081
|
async function loadThreadMessages(apiClient, threadId, setMessages) {
|
|
3055
3082
|
try {
|
|
3056
3083
|
const response = await apiClient.get("/apps/base/data-sources/message/items", {
|
|
3057
|
-
columns: "body_json,created_on,record_owner,role",
|
|
3058
|
-
filters: JSON.stringify({
|
|
3084
|
+
columns: "message_id,body_json,created_on,record_owner,role",
|
|
3085
|
+
filters: JSON.stringify({
|
|
3086
|
+
rules: [{ field: "thread", operator: "=", value: threadId }, { field: "archived", operator: "=", value: false }]
|
|
3087
|
+
}),
|
|
3059
3088
|
sort: JSON.stringify([{ field: "created_on", direction: "asc" }])
|
|
3060
3089
|
});
|
|
3061
3090
|
if (response.success && response.data) {
|
|
@@ -14288,6 +14317,7 @@ function CopyButton({ text }) {
|
|
|
14288
14317
|
}
|
|
14289
14318
|
var MessageItem = memo(({
|
|
14290
14319
|
message,
|
|
14320
|
+
messageIndex,
|
|
14291
14321
|
isStreaming,
|
|
14292
14322
|
logo,
|
|
14293
14323
|
userPhoto,
|
|
@@ -14297,9 +14327,33 @@ var MessageItem = memo(({
|
|
|
14297
14327
|
onToolAction,
|
|
14298
14328
|
openCanvasView,
|
|
14299
14329
|
onForwardToAgent,
|
|
14300
|
-
onUseWorkResult
|
|
14330
|
+
onUseWorkResult,
|
|
14331
|
+
onEditPrompt
|
|
14301
14332
|
}) => {
|
|
14333
|
+
const { t } = useAssistantTranslation();
|
|
14302
14334
|
const isAssistantMessage = message.role === "assistant";
|
|
14335
|
+
const isUserMessage = message.role === "user";
|
|
14336
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
14337
|
+
const [editingContent, setEditingContent] = useState("");
|
|
14338
|
+
const startEditing = useCallback(() => {
|
|
14339
|
+
const textPart = (message.parts || []).find((p) => p.type === "text");
|
|
14340
|
+
setEditingContent(textPart?.text || message.content || "");
|
|
14341
|
+
setIsEditing(true);
|
|
14342
|
+
}, [message]);
|
|
14343
|
+
const cancelEditing = useCallback(() => {
|
|
14344
|
+
setIsEditing(false);
|
|
14345
|
+
setEditingContent("");
|
|
14346
|
+
}, []);
|
|
14347
|
+
const saveEditing = useCallback(() => {
|
|
14348
|
+
setIsEditing(false);
|
|
14349
|
+
onEditPrompt?.(messageIndex, editingContent);
|
|
14350
|
+
}, [editingContent, messageIndex, onEditPrompt]);
|
|
14351
|
+
const handleTextareaKeyDown = useCallback((e) => {
|
|
14352
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
14353
|
+
e.preventDefault();
|
|
14354
|
+
saveEditing();
|
|
14355
|
+
}
|
|
14356
|
+
}, [saveEditing]);
|
|
14303
14357
|
const textContent = useMemo(() => {
|
|
14304
14358
|
return (message.parts || []).filter((p) => p.type === "text").map((p) => p.text || "").join("\n").trim();
|
|
14305
14359
|
}, [message.parts]);
|
|
@@ -14347,6 +14401,37 @@ var MessageItem = memo(({
|
|
|
14347
14401
|
] }, `${messageId}-tool-${idx}`);
|
|
14348
14402
|
};
|
|
14349
14403
|
const renderMessageContent = () => {
|
|
14404
|
+
if (isEditing && isUserMessage) {
|
|
14405
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-2", children: [
|
|
14406
|
+
/* @__PURE__ */ jsx(
|
|
14407
|
+
Textarea,
|
|
14408
|
+
{
|
|
14409
|
+
autoFocus: true,
|
|
14410
|
+
value: editingContent,
|
|
14411
|
+
onChange: (e) => setEditingContent(e.target.value),
|
|
14412
|
+
onKeyDown: handleTextareaKeyDown,
|
|
14413
|
+
className: "min-h-32 resize-none bg-white dark:bg-background"
|
|
14414
|
+
}
|
|
14415
|
+
),
|
|
14416
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2", children: [
|
|
14417
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", onClick: saveEditing, children: [
|
|
14418
|
+
/* @__PURE__ */ jsx(Check, {}),
|
|
14419
|
+
t("common.save_changes")
|
|
14420
|
+
] }),
|
|
14421
|
+
/* @__PURE__ */ jsx(
|
|
14422
|
+
Button,
|
|
14423
|
+
{
|
|
14424
|
+
type: "button",
|
|
14425
|
+
size: "icon-sm",
|
|
14426
|
+
variant: "destructive",
|
|
14427
|
+
"aria-label": t("common.cancel"),
|
|
14428
|
+
onClick: cancelEditing,
|
|
14429
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
14430
|
+
}
|
|
14431
|
+
)
|
|
14432
|
+
] })
|
|
14433
|
+
] });
|
|
14434
|
+
}
|
|
14350
14435
|
const parts = message.parts || [];
|
|
14351
14436
|
const hasParts = Array.isArray(parts) && parts.length > 0;
|
|
14352
14437
|
if (!hasParts) return message.content || "";
|
|
@@ -14405,9 +14490,25 @@ var MessageItem = memo(({
|
|
|
14405
14490
|
),
|
|
14406
14491
|
isStreaming && isAssistantMessage && /* @__PURE__ */ jsx(AssistantAnimations, { animationType: "working", agentId, className: "absolute -top-1 -left-1 w-14 h-14" })
|
|
14407
14492
|
] }),
|
|
14408
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
14409
|
-
|
|
14410
|
-
|
|
14493
|
+
/* @__PURE__ */ jsxs("div", { className: cn(
|
|
14494
|
+
"flex min-w-0 items-center",
|
|
14495
|
+
isEditing && isUserMessage ? "w-full flex-1" : "max-w-full",
|
|
14496
|
+
isUserMessage && "flex-row-reverse"
|
|
14497
|
+
), children: [
|
|
14498
|
+
/* @__PURE__ */ jsx(MessageContent, { className: cn(
|
|
14499
|
+
"group-[.is-user]:p-2 group-[.is-user]:mt-0.5",
|
|
14500
|
+
isEditing && isUserMessage && "flex-1 w-full max-w-full"
|
|
14501
|
+
), children: renderMessageContent() }),
|
|
14502
|
+
isAssistantMessage && !isStreaming && textContent && /* @__PURE__ */ jsx(MessageActions, { className: "mt-1 opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsx(CopyButton, { text: textContent }) }),
|
|
14503
|
+
isUserMessage && !isEditing && /* @__PURE__ */ jsx(MessageActions, { className: "mt-1 opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsx(
|
|
14504
|
+
MessageAction,
|
|
14505
|
+
{
|
|
14506
|
+
tooltip: t("common.edit_prompt"),
|
|
14507
|
+
onClick: startEditing,
|
|
14508
|
+
className: "h-7 w-7 text-muted-foreground hover:text-foreground",
|
|
14509
|
+
children: /* @__PURE__ */ jsx(Pencil, { className: "w-3.5 h-3.5" })
|
|
14510
|
+
}
|
|
14511
|
+
) })
|
|
14411
14512
|
] })
|
|
14412
14513
|
] }) }, message.id);
|
|
14413
14514
|
});
|
|
@@ -14427,7 +14528,8 @@ var MessageList = memo(({
|
|
|
14427
14528
|
onToolAction,
|
|
14428
14529
|
openCanvasView,
|
|
14429
14530
|
onForwardToAgent,
|
|
14430
|
-
onUseWorkResult
|
|
14531
|
+
onUseWorkResult,
|
|
14532
|
+
onEditPrompt
|
|
14431
14533
|
}) => {
|
|
14432
14534
|
const lastMsgIdx = messages.length - 1;
|
|
14433
14535
|
return /* @__PURE__ */ jsx(AIConversation, { className: cn("flex-1", className), children: /* @__PURE__ */ jsxs(AIConversationContent, { className: "p-4 h-full", children: [
|
|
@@ -14443,6 +14545,7 @@ var MessageList = memo(({
|
|
|
14443
14545
|
MessageItem,
|
|
14444
14546
|
{
|
|
14445
14547
|
message,
|
|
14548
|
+
messageIndex: msgIdx,
|
|
14446
14549
|
isStreaming,
|
|
14447
14550
|
logo,
|
|
14448
14551
|
userPhoto,
|
|
@@ -14452,7 +14555,8 @@ var MessageList = memo(({
|
|
|
14452
14555
|
onToolAction,
|
|
14453
14556
|
openCanvasView,
|
|
14454
14557
|
onForwardToAgent,
|
|
14455
|
-
onUseWorkResult
|
|
14558
|
+
onUseWorkResult,
|
|
14559
|
+
onEditPrompt
|
|
14456
14560
|
},
|
|
14457
14561
|
message.id
|
|
14458
14562
|
);
|
|
@@ -14501,6 +14605,7 @@ function ChatPanel({
|
|
|
14501
14605
|
onToolAction,
|
|
14502
14606
|
openCanvasView,
|
|
14503
14607
|
onSendSpreadsheetCommands: _onSendSpreadsheetCommands,
|
|
14608
|
+
onEditPrompt,
|
|
14504
14609
|
renderThreadHeader,
|
|
14505
14610
|
messagesClassName,
|
|
14506
14611
|
compactToolbar,
|
|
@@ -14604,6 +14709,7 @@ function ChatPanel({
|
|
|
14604
14709
|
agentId: tenantAiAgentId,
|
|
14605
14710
|
onToolAction,
|
|
14606
14711
|
openCanvasView,
|
|
14712
|
+
onEditPrompt,
|
|
14607
14713
|
className: messagesClassName
|
|
14608
14714
|
}
|
|
14609
14715
|
),
|
|
@@ -17531,7 +17637,7 @@ var buttonVariants = cva(
|
|
|
17531
17637
|
}
|
|
17532
17638
|
}
|
|
17533
17639
|
);
|
|
17534
|
-
var
|
|
17640
|
+
var Button30 = withTooltip(({
|
|
17535
17641
|
active,
|
|
17536
17642
|
asChild = false,
|
|
17537
17643
|
children,
|
|
@@ -18139,7 +18245,7 @@ function AIMenu() {
|
|
|
18139
18245
|
}
|
|
18140
18246
|
),
|
|
18141
18247
|
/* @__PURE__ */ jsx(
|
|
18142
|
-
|
|
18248
|
+
Button30,
|
|
18143
18249
|
{
|
|
18144
18250
|
className: "no-focus-ring mt-1 shrink-0",
|
|
18145
18251
|
disabled: !isLoading && input.trim().length === 0,
|
|
@@ -19013,7 +19119,7 @@ function Comment(props) {
|
|
|
19013
19119
|
] }),
|
|
19014
19120
|
isMyComment && (hovering || dropdownOpen) && /* @__PURE__ */ jsxs("div", { className: "absolute top-0 right-0 flex space-x-1", children: [
|
|
19015
19121
|
index === 0 && /* @__PURE__ */ jsx(
|
|
19016
|
-
|
|
19122
|
+
Button30,
|
|
19017
19123
|
{
|
|
19018
19124
|
className: "h-6 p-1 text-muted-foreground",
|
|
19019
19125
|
onClick: onResolveComment,
|
|
@@ -19062,7 +19168,7 @@ function Comment(props) {
|
|
|
19062
19168
|
),
|
|
19063
19169
|
isEditing && /* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 gap-1", children: [
|
|
19064
19170
|
/* @__PURE__ */ jsx(
|
|
19065
|
-
|
|
19171
|
+
Button30,
|
|
19066
19172
|
{
|
|
19067
19173
|
className: "size-[28px]",
|
|
19068
19174
|
onClick: (e) => {
|
|
@@ -19075,7 +19181,7 @@ function Comment(props) {
|
|
|
19075
19181
|
}
|
|
19076
19182
|
),
|
|
19077
19183
|
/* @__PURE__ */ jsx(
|
|
19078
|
-
|
|
19184
|
+
Button30,
|
|
19079
19185
|
{
|
|
19080
19186
|
onClick: (e) => {
|
|
19081
19187
|
e.stopPropagation();
|
|
@@ -19143,7 +19249,7 @@ function CommentMoreDropdown(props) {
|
|
|
19143
19249
|
onOpenChange: setDropdownOpen,
|
|
19144
19250
|
open: dropdownOpen,
|
|
19145
19251
|
children: [
|
|
19146
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger3, { asChild: true, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
|
|
19252
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger3, { asChild: true, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(Button30, { className: cn("h-6 p-1 text-muted-foreground"), variant: "ghost", children: /* @__PURE__ */ jsx(MoreHorizontalIcon, { className: "size-4" }) }) }),
|
|
19147
19253
|
/* @__PURE__ */ jsx(
|
|
19148
19254
|
DropdownMenuContent3,
|
|
19149
19255
|
{
|
|
@@ -19315,7 +19421,7 @@ function CommentCreateForm({
|
|
|
19315
19421
|
}
|
|
19316
19422
|
),
|
|
19317
19423
|
/* @__PURE__ */ jsx(
|
|
19318
|
-
|
|
19424
|
+
Button30,
|
|
19319
19425
|
{
|
|
19320
19426
|
className: "absolute right-0 bottom-0 ml-auto shrink-0",
|
|
19321
19427
|
disabled: commentContent.trim().length === 0,
|
|
@@ -19649,7 +19755,7 @@ function BlockSuggestionCard({
|
|
|
19649
19755
|
)),
|
|
19650
19756
|
hovering && /* @__PURE__ */ jsxs("div", { className: "absolute top-4 right-4 flex gap-2", children: [
|
|
19651
19757
|
/* @__PURE__ */ jsx(
|
|
19652
|
-
|
|
19758
|
+
Button30,
|
|
19653
19759
|
{
|
|
19654
19760
|
variant: "ghost",
|
|
19655
19761
|
className: "size-6 p-1 text-muted-foreground",
|
|
@@ -19658,7 +19764,7 @@ function BlockSuggestionCard({
|
|
|
19658
19764
|
}
|
|
19659
19765
|
),
|
|
19660
19766
|
/* @__PURE__ */ jsx(
|
|
19661
|
-
|
|
19767
|
+
Button30,
|
|
19662
19768
|
{
|
|
19663
19769
|
variant: "ghost",
|
|
19664
19770
|
className: "size-6 p-1 text-muted-foreground",
|
|
@@ -20128,7 +20234,7 @@ var BlockCommentsContent = ({
|
|
|
20128
20234
|
}
|
|
20129
20235
|
),
|
|
20130
20236
|
totalCount > 0 && /* @__PURE__ */ jsx("div", { className: "relative left-0 size-0 select-none", children: /* @__PURE__ */ jsx(PopoverTrigger11, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
20131
|
-
|
|
20237
|
+
Button30,
|
|
20132
20238
|
{
|
|
20133
20239
|
className: "mt-1 ml-1 flex h-6 gap-1 px-1.5 py-0 text-muted-foreground/80 hover:text-muted-foreground/80 data-[active=true]:bg-muted",
|
|
20134
20240
|
contentEditable: false,
|
|
@@ -22044,7 +22150,7 @@ function BlockActionButton({
|
|
|
22044
22150
|
const editor = useEditorRef();
|
|
22045
22151
|
const element = useElement();
|
|
22046
22152
|
return /* @__PURE__ */ jsx(
|
|
22047
|
-
|
|
22153
|
+
Button30,
|
|
22048
22154
|
{
|
|
22049
22155
|
className: cn(
|
|
22050
22156
|
defaultStyles && "absolute top-1 right-1 opacity-0 transition-opacity group-hover:opacity-100",
|
|
@@ -22383,7 +22489,7 @@ function EmojiPickerSearchAndClear({
|
|
|
22383
22489
|
}
|
|
22384
22490
|
),
|
|
22385
22491
|
searchValue && /* @__PURE__ */ jsx(
|
|
22386
|
-
|
|
22492
|
+
Button30,
|
|
22387
22493
|
{
|
|
22388
22494
|
"aria-label": "Clear",
|
|
22389
22495
|
className: cn(
|
|
@@ -22472,7 +22578,7 @@ function EmojiPickerNavigation({
|
|
|
22472
22578
|
id: "emoji-nav",
|
|
22473
22579
|
children: /* @__PURE__ */ jsxs("div", { className: "relative flex items-center", children: [
|
|
22474
22580
|
emojiLibrary.getGrid().sections().map(({ id }) => /* @__PURE__ */ jsx(
|
|
22475
|
-
|
|
22581
|
+
Button30,
|
|
22476
22582
|
{
|
|
22477
22583
|
"aria-label": i18n.categories[id],
|
|
22478
22584
|
className: cn(
|
|
@@ -22634,7 +22740,7 @@ function CalloutElement(props) {
|
|
|
22634
22740
|
{
|
|
22635
22741
|
...emojiToolbarDropdownProps,
|
|
22636
22742
|
control: /* @__PURE__ */ jsx(
|
|
22637
|
-
|
|
22743
|
+
Button30,
|
|
22638
22744
|
{
|
|
22639
22745
|
className: "size-6 select-none p-1 text-[18px] hover:bg-muted-foreground/15",
|
|
22640
22746
|
contentEditable: false,
|
|
@@ -22873,7 +22979,7 @@ function CodeBlockElement(props) {
|
|
|
22873
22979
|
contentEditable: false,
|
|
22874
22980
|
children: [
|
|
22875
22981
|
/* @__PURE__ */ jsxs(
|
|
22876
|
-
|
|
22982
|
+
Button30,
|
|
22877
22983
|
{
|
|
22878
22984
|
className: "relative top-0 right-0 w-auto",
|
|
22879
22985
|
onClick: () => {
|
|
@@ -22918,7 +23024,7 @@ function CodeBlockCombobox({ className }) {
|
|
|
22918
23024
|
if (readOnly) return null;
|
|
22919
23025
|
return /* @__PURE__ */ jsxs(Popover11, { onOpenChange: setOpen, open, children: [
|
|
22920
23026
|
/* @__PURE__ */ jsx(PopoverTrigger11, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
22921
|
-
|
|
23027
|
+
Button30,
|
|
22922
23028
|
{
|
|
22923
23029
|
"aria-expanded": open,
|
|
22924
23030
|
className: cn(
|
|
@@ -23279,7 +23385,7 @@ function Draggable(props) {
|
|
|
23279
23385
|
),
|
|
23280
23386
|
children: [
|
|
23281
23387
|
/* @__PURE__ */ jsx(
|
|
23282
|
-
|
|
23388
|
+
Button30,
|
|
23283
23389
|
{
|
|
23284
23390
|
className: "absolute right-0 h-6 w-6 p-0",
|
|
23285
23391
|
"data-plate-prevent-deselect": true,
|
|
@@ -23466,7 +23572,7 @@ var DraggableInsertHandle = () => {
|
|
|
23466
23572
|
const editor = useEditorRef();
|
|
23467
23573
|
const element = useElement();
|
|
23468
23574
|
return /* @__PURE__ */ jsx(
|
|
23469
|
-
|
|
23575
|
+
Button30,
|
|
23470
23576
|
{
|
|
23471
23577
|
className: "size-6 shrink-0 p-1",
|
|
23472
23578
|
onClick: (event) => {
|
|
@@ -24697,7 +24803,7 @@ function EquationPopoverContent({
|
|
|
24697
24803
|
...props
|
|
24698
24804
|
}
|
|
24699
24805
|
),
|
|
24700
|
-
/* @__PURE__ */ jsxs(
|
|
24806
|
+
/* @__PURE__ */ jsxs(Button30, { className: "px-3", onClick: onClose, variant: "brand", children: [
|
|
24701
24807
|
"Done ",
|
|
24702
24808
|
/* @__PURE__ */ jsx(CornerDownLeftIcon, { className: "size-3.5" })
|
|
24703
24809
|
] })
|
|
@@ -25575,7 +25681,7 @@ function MediaPlaceholderPopover({ children }) {
|
|
|
25575
25681
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "password", children: "Embed link" })
|
|
25576
25682
|
] }),
|
|
25577
25683
|
/* @__PURE__ */ jsxs(TabsContent, { className: "w-[300px] px-3 py-2", value: "account", children: [
|
|
25578
|
-
/* @__PURE__ */ jsx(
|
|
25684
|
+
/* @__PURE__ */ jsx(Button30, { className: "w-full", onClick: openFilePicker, variant: "brand", children: currentMedia.buttonText }),
|
|
25579
25685
|
/* @__PURE__ */ jsx("div", { className: "mt-3 text-muted-foreground text-xs", children: "The maximum size per file is 5MB" })
|
|
25580
25686
|
] }),
|
|
25581
25687
|
/* @__PURE__ */ jsxs(
|
|
@@ -25593,7 +25699,7 @@ function MediaPlaceholderPopover({ children }) {
|
|
|
25593
25699
|
}
|
|
25594
25700
|
),
|
|
25595
25701
|
/* @__PURE__ */ jsx(
|
|
25596
|
-
|
|
25702
|
+
Button30,
|
|
25597
25703
|
{
|
|
25598
25704
|
className: "mt-2 w-full max-w-[300px]",
|
|
25599
25705
|
onClick: () => onEmbed(embedValue),
|
|
@@ -25713,12 +25819,12 @@ function ImagePreview() {
|
|
|
25713
25819
|
onClick: (e) => e.stopPropagation(),
|
|
25714
25820
|
children: [
|
|
25715
25821
|
!prevDisabled && !nextDisabled && /* @__PURE__ */ jsxs("div", { className: "flex rounded-sm bg-black/70", children: [
|
|
25716
|
-
/* @__PURE__ */ jsx(
|
|
25717
|
-
/* @__PURE__ */ jsx(
|
|
25822
|
+
/* @__PURE__ */ jsx(Button30, { ...prevProps, disabled: prevDisabled, children: /* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-5" }) }),
|
|
25823
|
+
/* @__PURE__ */ jsx(Button30, { ...nextProps, disabled: nextDisabled, children: /* @__PURE__ */ jsx(ArrowRightIcon, { className: "size-5" }) })
|
|
25718
25824
|
] }),
|
|
25719
25825
|
currentPreview && /* @__PURE__ */ jsxs("div", { className: "flex rounded-sm bg-black/70", children: [
|
|
25720
25826
|
/* @__PURE__ */ jsx(
|
|
25721
|
-
|
|
25827
|
+
Button30,
|
|
25722
25828
|
{
|
|
25723
25829
|
...zommOutProps,
|
|
25724
25830
|
disabled: zoomOutDisabled,
|
|
@@ -25731,7 +25837,7 @@ function ImagePreview() {
|
|
|
25731
25837
|
/* @__PURE__ */ jsx("div", { children: "%" })
|
|
25732
25838
|
] }),
|
|
25733
25839
|
/* @__PURE__ */ jsx(
|
|
25734
|
-
|
|
25840
|
+
Button30,
|
|
25735
25841
|
{
|
|
25736
25842
|
...zoomInProps,
|
|
25737
25843
|
disabled: zoomInDisabled,
|
|
@@ -25740,7 +25846,7 @@ function ImagePreview() {
|
|
|
25740
25846
|
}
|
|
25741
25847
|
),
|
|
25742
25848
|
/* @__PURE__ */ jsx(
|
|
25743
|
-
|
|
25849
|
+
Button30,
|
|
25744
25850
|
{
|
|
25745
25851
|
onClick: () => {
|
|
25746
25852
|
void downloadFile(currentPreview.url, currentPreview.id);
|
|
@@ -25749,7 +25855,7 @@ function ImagePreview() {
|
|
|
25749
25855
|
children: /* @__PURE__ */ jsx(CircleArrowDown, { className: "size-4" })
|
|
25750
25856
|
}
|
|
25751
25857
|
),
|
|
25752
|
-
/* @__PURE__ */ jsx(
|
|
25858
|
+
/* @__PURE__ */ jsx(Button30, { ...closeProps, tooltip: "Close", children: /* @__PURE__ */ jsx(Minimize2, { className: "size-4" }) })
|
|
25753
25859
|
] })
|
|
25754
25860
|
]
|
|
25755
25861
|
}
|
|
@@ -26389,7 +26495,7 @@ var TableElement = withHOC(
|
|
|
26389
26495
|
"group-has-[tr:last-child:hover]/table:opacity-100 max-sm:group-has-[tr[data-selected]:last-child]/table:opacity-100"
|
|
26390
26496
|
),
|
|
26391
26497
|
children: /* @__PURE__ */ jsx(
|
|
26392
|
-
|
|
26498
|
+
Button30,
|
|
26393
26499
|
{
|
|
26394
26500
|
className: "flex h-4 w-full grow items-center justify-center bg-muted",
|
|
26395
26501
|
onClick: () => tf.insert.tableRow({ at: editor.api.findPath(element) }),
|
|
@@ -26411,7 +26517,7 @@ var TableElement = withHOC(
|
|
|
26411
26517
|
"group-has-[td:last-child:hover,th:last-child:hover]/table:opacity-100 max-sm:group-has-[td[data-selected]:last-child,th[data-selected]:last-child]/table:opacity-100"
|
|
26412
26518
|
),
|
|
26413
26519
|
children: /* @__PURE__ */ jsx(
|
|
26414
|
-
|
|
26520
|
+
Button30,
|
|
26415
26521
|
{
|
|
26416
26522
|
className: "flex h-full w-4 grow items-center justify-center bg-muted",
|
|
26417
26523
|
onClick: () => tf.insert.tableColumn({
|
|
@@ -26435,7 +26541,7 @@ var TableElement = withHOC(
|
|
|
26435
26541
|
"group-has-[td:last-child:hover,th:last-child:hover]/table:group-has-[tr:last-child:hover]/table:opacity-100 max-sm:group-has-[td[data-selected]:last-child,th[data-selected]:last-child]/table:group-has-[tr[data-selected]:last-child]/table:opacity-100"
|
|
26436
26542
|
),
|
|
26437
26543
|
children: /* @__PURE__ */ jsx(
|
|
26438
|
-
|
|
26544
|
+
Button30,
|
|
26439
26545
|
{
|
|
26440
26546
|
className: "flex size-4 items-center justify-center rounded-full bg-muted",
|
|
26441
26547
|
onClick: () => {
|
|
@@ -26641,7 +26747,7 @@ function TocElement(props) {
|
|
|
26641
26747
|
const { headingList } = state;
|
|
26642
26748
|
return /* @__PURE__ */ jsxs(PlateElement, { ...props, className: "my-1", children: [
|
|
26643
26749
|
/* @__PURE__ */ jsx("div", { contentEditable: false, children: headingList.length > 0 ? headingList.map((item) => /* @__PURE__ */ jsx(
|
|
26644
|
-
|
|
26750
|
+
Button30,
|
|
26645
26751
|
{
|
|
26646
26752
|
"aria-current": true,
|
|
26647
26753
|
className: headingItemVariants({ depth: item.depth }),
|
|
@@ -27743,7 +27849,7 @@ function TocElementStatic(props) {
|
|
|
27743
27849
|
const headingList = getHeadingList(editor);
|
|
27744
27850
|
return /* @__PURE__ */ jsxs(SlateElement, { ...props, className: "mb-1 p-0", children: [
|
|
27745
27851
|
/* @__PURE__ */ jsx("div", { children: headingList.length > 0 ? headingList.map((item) => /* @__PURE__ */ jsx(
|
|
27746
|
-
|
|
27852
|
+
Button30,
|
|
27747
27853
|
{
|
|
27748
27854
|
className: headingItemVariants2({ depth: item.depth }),
|
|
27749
27855
|
variant: "ghost",
|
|
@@ -29409,7 +29515,20 @@ function CanvasTextView({
|
|
|
29409
29515
|
}
|
|
29410
29516
|
return /* @__PURE__ */ jsx("div", { className: "h-full w-full overflow-x-auto", children: /* @__PURE__ */ jsx(CanvasCodeView, { contentText, language, title }) });
|
|
29411
29517
|
}
|
|
29518
|
+
var stripUploadTagsFromText = (text) => text.replace(/<first_lines_of_csv_file>[\s\S]*?<\/first_lines_of_csv_file>/g, "").replace(/<attached_files>[\s\S]*?<\/attached_files>/g, "").replace(/<docx_file_content[^>]*>[\s\S]*?<\/docx_file_content>/g, "");
|
|
29412
29519
|
var AssistantView = ({ ref, ...props }) => {
|
|
29520
|
+
const filteredMessages = useMemo(() => (props.messages ?? []).map((message) => {
|
|
29521
|
+
if (message?.role !== "user" || !Array.isArray(message.parts)) return message;
|
|
29522
|
+
return {
|
|
29523
|
+
...message,
|
|
29524
|
+
parts: message.parts.map((part) => {
|
|
29525
|
+
if (part?.type === "text" && typeof part.text === "string") {
|
|
29526
|
+
return { ...part, text: stripUploadTagsFromText(part.text) };
|
|
29527
|
+
}
|
|
29528
|
+
return part;
|
|
29529
|
+
})
|
|
29530
|
+
};
|
|
29531
|
+
}), [props.messages]);
|
|
29413
29532
|
const [canvasWork, setCanvasWork] = useState(null);
|
|
29414
29533
|
const [canvasVersions, setCanvasVersions] = useState([]);
|
|
29415
29534
|
const [canvasVersionsLoading, setCanvasVersionsLoading] = useState(false);
|
|
@@ -29659,7 +29778,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
29659
29778
|
return /* @__PURE__ */ jsx(
|
|
29660
29779
|
ChatPanel,
|
|
29661
29780
|
{
|
|
29662
|
-
messages:
|
|
29781
|
+
messages: filteredMessages,
|
|
29663
29782
|
isLoading: commonProps2.isLoading,
|
|
29664
29783
|
input: commonProps2.input,
|
|
29665
29784
|
onInputChange: commonProps2.onInputChange,
|
|
@@ -29690,6 +29809,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
29690
29809
|
onMicrophoneClick: commonProps2.onMicrophoneClick,
|
|
29691
29810
|
onToolAction: commonProps2.onToolAction,
|
|
29692
29811
|
openCanvasView: handleOpenCanvasView,
|
|
29812
|
+
onEditPrompt: commonProps2.onEditPrompt,
|
|
29693
29813
|
showWelcome: commonProps2.showWelcome,
|
|
29694
29814
|
recentSessions: commonProps2.recentSessions,
|
|
29695
29815
|
onSessionClick: commonProps2.onSessionClick,
|
|
@@ -30116,7 +30236,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
30116
30236
|
/* @__PURE__ */ jsx(
|
|
30117
30237
|
ChatPanel,
|
|
30118
30238
|
{
|
|
30119
|
-
messages:
|
|
30239
|
+
messages: filteredMessages,
|
|
30120
30240
|
isLoading: commonProps.isLoading,
|
|
30121
30241
|
input: commonProps.input,
|
|
30122
30242
|
onInputChange: commonProps.onInputChange,
|
|
@@ -30147,6 +30267,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
30147
30267
|
onMicrophoneClick: commonProps.onMicrophoneClick,
|
|
30148
30268
|
onToolAction: commonProps.onToolAction,
|
|
30149
30269
|
openCanvasView: handleOpenCanvasViewInline,
|
|
30270
|
+
onEditPrompt: commonProps.onEditPrompt,
|
|
30150
30271
|
renderThreadHeader,
|
|
30151
30272
|
showWelcome: commonProps.showWelcome,
|
|
30152
30273
|
recentSessions: commonProps.recentSessions,
|
|
@@ -31492,6 +31613,7 @@ var DocyAssistant = ({
|
|
|
31492
31613
|
initialModelId,
|
|
31493
31614
|
initialFeatures,
|
|
31494
31615
|
initialFiles,
|
|
31616
|
+
environment,
|
|
31495
31617
|
...props
|
|
31496
31618
|
}) => {
|
|
31497
31619
|
const config3 = useAssistantConfig();
|
|
@@ -31569,6 +31691,7 @@ var DocyAssistant = ({
|
|
|
31569
31691
|
supportDocumentSearch: options3?.supportDocumentSearch,
|
|
31570
31692
|
supportThinking: options3?.supportThinking,
|
|
31571
31693
|
supportWorkCanvas: options3?.supportWorkCanvas,
|
|
31694
|
+
...environment ? { environment } : {},
|
|
31572
31695
|
...options3?.filePaths?.length ? { files: options3.filePaths } : {}
|
|
31573
31696
|
}
|
|
31574
31697
|
};
|
|
@@ -31588,7 +31711,8 @@ var DocyAssistant = ({
|
|
|
31588
31711
|
baseUrl,
|
|
31589
31712
|
apiEndpoint,
|
|
31590
31713
|
activeAgentId,
|
|
31591
|
-
deploymentId
|
|
31714
|
+
deploymentId,
|
|
31715
|
+
environment
|
|
31592
31716
|
]);
|
|
31593
31717
|
const {
|
|
31594
31718
|
messages = [],
|
|
@@ -31902,6 +32026,24 @@ var DocyAssistant = ({
|
|
|
31902
32026
|
const handleInputChange = useCallback((e) => {
|
|
31903
32027
|
setInput(e.target.value);
|
|
31904
32028
|
}, []);
|
|
32029
|
+
const handleEditPrompt = useCallback(async (messageIndex, newText) => {
|
|
32030
|
+
const targetMessage = messages[messageIndex];
|
|
32031
|
+
const threadId = selectedSessionIdRef.current;
|
|
32032
|
+
if (threadId && targetMessage?.id) {
|
|
32033
|
+
const res = await apiClient.post(`ai/regenerate/${threadId}/${targetMessage.id}`);
|
|
32034
|
+
const desc = `${res.error_description || ""} ${res.error || ""}`;
|
|
32035
|
+
if (!res.success && !/not found/i.test(desc)) {
|
|
32036
|
+
console.warn("Regenerate archive call failed:", res);
|
|
32037
|
+
}
|
|
32038
|
+
}
|
|
32039
|
+
setMessages((prev) => prev.slice(0, messageIndex));
|
|
32040
|
+
await sendMessage({ text: newText });
|
|
32041
|
+
}, [
|
|
32042
|
+
messages,
|
|
32043
|
+
apiClient,
|
|
32044
|
+
setMessages,
|
|
32045
|
+
sendMessage
|
|
32046
|
+
]);
|
|
31905
32047
|
const handleProjectMessage = async (e) => {
|
|
31906
32048
|
e?.preventDefault();
|
|
31907
32049
|
if (!input.trim() || !projectState.selectedProject) return;
|
|
@@ -32046,6 +32188,7 @@ var DocyAssistant = ({
|
|
|
32046
32188
|
input,
|
|
32047
32189
|
onInputChange: handleInputChange,
|
|
32048
32190
|
onSendMessage: handleSendMessage,
|
|
32191
|
+
onEditPrompt: handleEditPrompt,
|
|
32049
32192
|
onStop: stop,
|
|
32050
32193
|
title: isLoadingAgentDetails ? "" : agentDetails?.name ?? title,
|
|
32051
32194
|
description,
|