@docyrus/ui-pro-ai-assistant 0.4.9 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createContext, memo, useMemo, useEffect, useState, useRef, useCallback, useLayoutEffect, use, startTransition, Fragment as Fragment$1, useSyncExternalStore, useId, useReducer, useImperativeHandle, Component } from 'react';
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, Pencil, PlusCircle, HelpCircle, Maximize2, X, 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';
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, MessageAction, Tool, ToolHeader, ToolContent, ToolInput, ToolOutput, CodeBlock, CodeBlockCopyButton, resolveToolIcon, PromptInputButton, PromptInput, PromptInputTextarea, PromptInputFooter, PromptInputTools, PromptInputSubmit, usePromptInputAttachments } from '@docyrus/ui-pro-shared/ai';
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({ rules: [{ field: "thread", operator: "=", value: threadId }] }),
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: "flex min-w-0 max-w-full items-center", children: [
14409
- /* @__PURE__ */ jsx(MessageContent, { className: "group-[.is-user]:p-2 group-[.is-user]:mt-0.5", children: renderMessageContent() }),
14410
- isAssistantMessage && !isStreaming && textContent && /* @__PURE__ */ jsx(MessageActions, { className: "mt-1 opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsx(CopyButton, { text: textContent }) })
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 Button29 = withTooltip(({
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
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(Button29, { className: cn("h-6 p-1 text-muted-foreground"), variant: "ghost", children: /* @__PURE__ */ jsx(MoreHorizontalIcon, { className: "size-4" }) }) }),
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
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(Button29, { className: "px-3", onClick: onClose, variant: "brand", children: [
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(Button29, { className: "w-full", onClick: openFilePicker, variant: "brand", children: currentMedia.buttonText }),
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
- Button29,
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(Button29, { ...prevProps, disabled: prevDisabled, children: /* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-5" }) }),
25717
- /* @__PURE__ */ jsx(Button29, { ...nextProps, disabled: nextDisabled, children: /* @__PURE__ */ jsx(ArrowRightIcon, { className: "size-5" }) })
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
- Button29,
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
- Button29,
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
- Button29,
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(Button29, { ...closeProps, tooltip: "Close", children: /* @__PURE__ */ jsx(Minimize2, { className: "size-4" }) })
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
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
- Button29,
27852
+ Button30,
27747
27853
  {
27748
27854
  className: headingItemVariants2({ depth: item.depth }),
27749
27855
  variant: "ghost",
@@ -29690,6 +29796,7 @@ var AssistantView = ({ ref, ...props }) => {
29690
29796
  onMicrophoneClick: commonProps2.onMicrophoneClick,
29691
29797
  onToolAction: commonProps2.onToolAction,
29692
29798
  openCanvasView: handleOpenCanvasView,
29799
+ onEditPrompt: commonProps2.onEditPrompt,
29693
29800
  showWelcome: commonProps2.showWelcome,
29694
29801
  recentSessions: commonProps2.recentSessions,
29695
29802
  onSessionClick: commonProps2.onSessionClick,
@@ -30147,6 +30254,7 @@ var AssistantView = ({ ref, ...props }) => {
30147
30254
  onMicrophoneClick: commonProps.onMicrophoneClick,
30148
30255
  onToolAction: commonProps.onToolAction,
30149
30256
  openCanvasView: handleOpenCanvasViewInline,
30257
+ onEditPrompt: commonProps.onEditPrompt,
30150
30258
  renderThreadHeader,
30151
30259
  showWelcome: commonProps.showWelcome,
30152
30260
  recentSessions: commonProps.recentSessions,
@@ -30659,7 +30767,7 @@ var AssistantProjectDetailView = ({
30659
30767
  showToolbar: true
30660
30768
  }
30661
30769
  ) }),
30662
- /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxs(Tabs$1, { value: activeTab, onValueChange: setActiveTab, className: "w-full", children: [
30770
+ /* @__PURE__ */ jsx("div", { className: "mt-8", children: /* @__PURE__ */ jsxs(Tabs$1, { value: activeTab, onValueChange: setActiveTab, className: "w-full", children: [
30663
30771
  /* @__PURE__ */ jsxs(TabsList$1, { className: "grid w-full grid-cols-3", children: [
30664
30772
  /* @__PURE__ */ jsx(TabsTrigger$1, { value: "sessions", children: t("tabs.sessions") }),
30665
30773
  /* @__PURE__ */ jsx(TabsTrigger$1, { value: "works", children: t("tabs.works") }),
@@ -30794,6 +30902,7 @@ var AssistantProjectsPanel = ({
30794
30902
  onEditProject,
30795
30903
  onDeleteProject,
30796
30904
  compact = false,
30905
+ sidebarOffset = false,
30797
30906
  t
30798
30907
  }) => {
30799
30908
  const filtered = projects.filter((p) => {
@@ -30801,10 +30910,10 @@ var AssistantProjectsPanel = ({
30801
30910
  const q = searchQuery.toLowerCase();
30802
30911
  return p.name.toLowerCase().includes(q) || p.description && p.description.toLowerCase().includes(q);
30803
30912
  });
30804
- return /* @__PURE__ */ jsxs("div", { className: `flex-1 flex flex-col overflow-y-auto ${compact ? "p-3" : "p-6"}`, children: [
30805
- /* @__PURE__ */ jsxs("div", { className: `flex items-center justify-between ${compact ? "mb-3" : "mb-6"}`, children: [
30913
+ return /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col overflow-y-auto p-6", children: [
30914
+ /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between mb-6", sidebarOffset && "ml-6"), children: [
30806
30915
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0", children: [
30807
- /* @__PURE__ */ jsx("h1", { className: `font-semibold ps-2 truncate ${compact ? "text-base" : "text-2xl"}`, children: t("sections.projects") }),
30916
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold ps-2 truncate", children: t("sections.projects") }),
30808
30917
  !compact && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground ps-2", children: t("descriptions.manage_projects") })
30809
30918
  ] }),
30810
30919
  /* @__PURE__ */ jsxs(Button, { size: "sm", onClick: onNewProject, className: "shrink-0", children: [
@@ -30812,7 +30921,7 @@ var AssistantProjectsPanel = ({
30812
30921
  !compact && t("buttons.new_project")
30813
30922
  ] })
30814
30923
  ] }),
30815
- /* @__PURE__ */ jsx("div", { className: `flex items-center gap-4 ${compact ? "mb-3" : "mb-6"}`, children: /* @__PURE__ */ jsxs("div", { className: "relative flex-1", children: [
30924
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 mb-6", children: /* @__PURE__ */ jsxs("div", { className: "relative flex-1", children: [
30816
30925
  /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground w-4 h-4" }),
30817
30926
  /* @__PURE__ */ jsx(
30818
30927
  Input,
@@ -31039,11 +31148,13 @@ var SidebarContent = ({
31039
31148
  onShowMoreProjects,
31040
31149
  onNewProject,
31041
31150
  onToggleSidebar,
31151
+ supportWorkCanvas = true,
31042
31152
  t
31043
31153
  }) => {
31044
- const [activeListType, setActiveListType] = useState("sessions");
31154
+ const [storedListType, setActiveListType] = useState("sessions");
31155
+ const activeListType = !supportWorkCanvas && storedListType === "works" ? "sessions" : storedListType;
31045
31156
  const [openMenuId, setOpenMenuId] = useState(null);
31046
- const navItems = [{ id: 1, label: t("tabs.sessions"), icon: MessageSquare }, { id: 3, label: t("tabs.works"), icon: NotebookText }];
31157
+ const navItems = [{ id: 1, label: t("tabs.sessions"), icon: MessageSquare }, ...supportWorkCanvas ? [{ id: 3, label: t("tabs.works"), icon: NotebookText }] : []];
31047
31158
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-1 min-h-0", children: [
31048
31159
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-px", children: [
31049
31160
  /* @__PURE__ */ jsx(
@@ -31115,7 +31226,7 @@ var SidebarContent = ({
31115
31226
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col mt-4 flex-1 min-h-0", children: [
31116
31227
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-start px-2 py-1.5 shrink-0", children: [
31117
31228
  /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold uppercase tracking-tight text-muted-foreground", children: t("sections.recents") }),
31118
- /* @__PURE__ */ jsxs(DropdownMenu$1, { children: [
31229
+ supportWorkCanvas ? /* @__PURE__ */ jsxs(DropdownMenu$1, { children: [
31119
31230
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
31120
31231
  Button,
31121
31232
  {
@@ -31158,7 +31269,7 @@ var SidebarContent = ({
31158
31269
  }
31159
31270
  )
31160
31271
  ] })
31161
- ] })
31272
+ ] }) : /* @__PURE__ */ jsx("span", { className: "ml-1 px-1 py-0 text-xs font-semibold uppercase tracking-tight text-muted-foreground", children: `${t("tabs.sessions")} (${sessions.length})` })
31162
31273
  ] }),
31163
31274
  /* @__PURE__ */ jsx(
31164
31275
  "div",
@@ -31507,6 +31618,9 @@ var DocyAssistant = ({
31507
31618
  };
31508
31619
  const [activeAgentId, setActiveAgentId] = useState(resolveInitialAgentId);
31509
31620
  const [deploymentId, setDeploymentId] = useState(resolveInitialDeploymentId);
31621
+ const isBaseAgent = !deploymentId && !!tenantAiAgentId;
31622
+ const { capabilities: agentCapabilities } = useDeploymentData(deploymentId || activeAgentId, supportMultiModels, isBaseAgent);
31623
+ const effectiveSupportWorkCanvas = agentCapabilities ? agentCapabilities.supportWorkCanvas : supportWorkCanvas;
31510
31624
  const title = titleProp || "DocyAssistant";
31511
31625
  const description = descriptionProp || t("descriptions.default");
31512
31626
  const placeholder = placeholderProp || t("placeholders.type_message");
@@ -31896,6 +32010,24 @@ var DocyAssistant = ({
31896
32010
  const handleInputChange = useCallback((e) => {
31897
32011
  setInput(e.target.value);
31898
32012
  }, []);
32013
+ const handleEditPrompt = useCallback(async (messageIndex, newText) => {
32014
+ const targetMessage = messages[messageIndex];
32015
+ const threadId = selectedSessionIdRef.current;
32016
+ if (threadId && targetMessage?.id) {
32017
+ const res = await apiClient.post(`ai/regenerate/${threadId}/${targetMessage.id}`);
32018
+ const desc = `${res.error_description || ""} ${res.error || ""}`;
32019
+ if (!res.success && !/not found/i.test(desc)) {
32020
+ console.warn("Regenerate archive call failed:", res);
32021
+ }
32022
+ }
32023
+ setMessages((prev) => prev.slice(0, messageIndex));
32024
+ await sendMessage({ text: newText });
32025
+ }, [
32026
+ messages,
32027
+ apiClient,
32028
+ setMessages,
32029
+ sendMessage
32030
+ ]);
31899
32031
  const handleProjectMessage = async (e) => {
31900
32032
  e?.preventDefault();
31901
32033
  if (!input.trim() || !projectState.selectedProject) return;
@@ -32025,6 +32157,7 @@ var DocyAssistant = ({
32025
32157
  projectActions.setView("create");
32026
32158
  },
32027
32159
  onToggleSidebar: isFloating && !uiState.isExpanded ? () => uiActions.setSidebarOpen(false) : void 0,
32160
+ supportWorkCanvas: effectiveSupportWorkCanvas,
32028
32161
  t
32029
32162
  }
32030
32163
  );
@@ -32039,6 +32172,7 @@ var DocyAssistant = ({
32039
32172
  input,
32040
32173
  onInputChange: handleInputChange,
32041
32174
  onSendMessage: handleSendMessage,
32175
+ onEditPrompt: handleEditPrompt,
32042
32176
  onStop: stop,
32043
32177
  title: isLoadingAgentDetails ? "" : agentDetails?.name ?? title,
32044
32178
  description,
@@ -32312,6 +32446,7 @@ var DocyAssistant = ({
32312
32446
  projectActions.setDeleteDialogOpen(true);
32313
32447
  },
32314
32448
  compact: enableNavDropdown,
32449
+ sidebarOffset: !uiState.isSidebarOpen && enableSidebar,
32315
32450
  t
32316
32451
  }
32317
32452
  ),