@oscloudlab/vgen-agent-assistant 0.0.17 → 0.0.19

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.
Binary file
Binary file
@@ -382,10 +382,15 @@ export interface BottomChatDockProps {
382
382
  * (宿主提供挂载槽位,见 KnowledgeCard bottomDockLayout='inline' 布局)
383
383
  */
384
384
  export interface BottomChatPanelProps extends BottomChatDockProps {
385
- /** 展开态面板列宽(number 按 px 处理),缺省 320;收起态固定为左侧窄竖条,仍在布局内占位 */
385
+ /** 展开态面板初始列宽兼拖拽下限(number 按 px 处理),缺省 320;resizable=true 时展开态可拖拽在
386
+ * [width, 50vw] 区间内自由拉伸;收起态固定为左侧窄竖条,仍在布局内占位 */
386
387
  width?: number | string;
387
388
  /** 是否支持收起为左侧窄竖条(不提供时缺省 true,收起后仍在布局中占位) */
388
389
  collapsible?: boolean;
390
+ /** 展开态右缘是否可拖拽调整宽度(缺省 true);false 时回退纯固定宽(原行为) */
391
+ resizable?: boolean;
392
+ /** 拖拽或键盘(←/→)调整宽度结束时回调最新宽度(px),宿主可据此持久化用户偏好 */
393
+ onWidthChange?: (width: number) => void;
389
394
  }
390
395
  export interface addTaskProps {
391
396
  id?: number;
@@ -1,6 +1,6 @@
1
1
  import require$$0, { memo, useState, useEffect, useMemo, useRef, forwardRef, useImperativeHandle, useCallback } from "react";
2
2
  import { message, Spin, Badge, Button, ConfigProvider, Modal, TimePicker, Select, Collapse, Form, Input, Checkbox, Tree, Dropdown, Tooltip, Popconfirm, Popover } from "antd";
3
- import { FileText, FishSymbol, Target, GraduationCap, Video, BookOpen, Lightbulb, Code2, Search, X, RefreshCw, ArrowRight, Play, Eye, Zap, FileDiff, User, Pencil, Check, Copy, Wand2, RefreshCcw, BookOpenText, Star, GitBranch, FileCode, Trophy, MessageCircleQuestion, Sparkles, ListChecks, ChevronDown, ChevronUp, Paperclip, StopCircle, Send, PanelLeftClose, PanelLeftOpen, Folder, Trash2, Cookie, Plus, History, Minimize2 } from "lucide-react";
3
+ import { FileText, FishSymbol, Target, GraduationCap, Video, BookOpen, Lightbulb, Code2, Search, X, RefreshCw, ArrowRight, Play, Eye, Zap, FileDiff, User, Pencil, Check, Copy, Wand2, RefreshCcw, BookOpenText, Star, GitBranch, FileCode, Trophy, MessageCircleQuestion, Sparkles, ChevronDown, ChevronUp, Paperclip, StopCircle, Send, PanelLeftClose, PanelLeftOpen, Folder, Trash2, Cookie, Plus, History, Minimize2 } from "lucide-react";
4
4
  import pako from "pako";
5
5
  import { twMerge } from "tailwind-merge";
6
6
  import "moment";
@@ -18086,7 +18086,7 @@ const useVgenChat = (props) => {
18086
18086
  }
18087
18087
  };
18088
18088
  const toUpdateMsgs = async () => {
18089
- var _a, _b, _c;
18089
+ var _a, _b, _c, _d;
18090
18090
  const realChatId = chatIdRef.current || chatId;
18091
18091
  const res = await getSesstionList({
18092
18092
  sessionId: realChatId
@@ -18097,10 +18097,19 @@ const useVgenChat = (props) => {
18097
18097
  textSummary(item.content)
18098
18098
  )
18099
18099
  );
18100
+ const oldIdSet = new Set((_b = messgaesRef.current) == null ? void 0 : _b.map((item) => item.id));
18100
18101
  const saveMsgArr = [...messgaesRef.current];
18101
- (_c = (_b = res == null ? void 0 : res.messages) == null ? void 0 : _b.reverse()) == null ? void 0 : _c.forEach((item) => {
18102
- if (!oldMsgSummaryArr.includes(textSummary(item.content))) {
18103
- saveMsgArr.unshift(item);
18102
+ (_d = (_c = res == null ? void 0 : res.messages) == null ? void 0 : _c.reverse()) == null ? void 0 : _d.forEach((item) => {
18103
+ const summary = textSummary(item.content);
18104
+ if (summary) {
18105
+ if (!oldMsgSummaryArr.includes(summary)) {
18106
+ saveMsgArr.unshift(item);
18107
+ }
18108
+ } else {
18109
+ if (!item.messageType || item.messageType === msgType$1.TEXT) return;
18110
+ if (item.id != null && !oldIdSet.has(item.id)) {
18111
+ saveMsgArr.unshift(item);
18112
+ }
18104
18113
  }
18105
18114
  });
18106
18115
  setMessages(saveMsgArr);
@@ -18418,17 +18427,17 @@ const GENERAL_CHIPS = [
18418
18427
  mode: "prefill",
18419
18428
  fill: "我想问一下:"
18420
18429
  },
18421
- {
18422
- icon: ListChecks,
18423
- label: "再出几题",
18424
- mode: "prefill",
18425
- fill: "再出3道问答题"
18426
- },
18430
+ // {
18431
+ // icon: ListChecks,
18432
+ // label: '再出几题',
18433
+ // mode: 'prefill',
18434
+ // fill: '再出3道问答题',
18435
+ // },
18427
18436
  {
18428
18437
  icon: Sparkles,
18429
18438
  label: "润色全文",
18430
18439
  mode: "prefill",
18431
- fill: "帮我润色一下,改成通俗版"
18440
+ fill: "帮我润色一下知识文本讲解,改成通俗版"
18432
18441
  }
18433
18442
  ];
18434
18443
  const detectIntent = (text2) => {
@@ -18666,6 +18675,18 @@ const BottomChatDock = (props) => {
18666
18675
  ) });
18667
18676
  };
18668
18677
  const COLLAPSED_WIDTH = 52;
18678
+ const RESIZE_KEY_STEP = 16;
18679
+ const resolveMinWidth = (width) => {
18680
+ if (typeof width === "number") return width > 0 ? width : null;
18681
+ const w = width.trim();
18682
+ let m = /^(\d+(?:\.\d+)?)px$/.exec(w);
18683
+ if (m) return Number(m[1]);
18684
+ m = /^(\d+(?:\.\d+)?)$/.exec(w);
18685
+ if (m) return Number(m[1]);
18686
+ m = /^(\d+(?:\.\d+)?)%$/.exec(w);
18687
+ if (m) return Number(m[1]) / 100 * window.innerWidth;
18688
+ return null;
18689
+ };
18669
18690
  const BottomChatPanel = (props) => {
18670
18691
  const {
18671
18692
  state = "fresh",
@@ -18682,10 +18703,57 @@ const BottomChatPanel = (props) => {
18682
18703
  onClearQuote,
18683
18704
  customDiffViewer,
18684
18705
  width = 320,
18685
- collapsible = true
18706
+ collapsible = true,
18707
+ resizable = true,
18708
+ onWidthChange
18686
18709
  } = props;
18687
18710
  const expandedOpen = collapsible ? open : true;
18688
- const panelWidth = typeof width === "number" ? `${width}px` : width;
18711
+ const [dragWidth, setDragWidth] = useState(null);
18712
+ const [resizing, setResizing] = useState(false);
18713
+ const panelRef = useRef(null);
18714
+ const resizeRef = useRef(null);
18715
+ const panelWidth = dragWidth !== null ? `${Math.round(dragWidth)}px` : typeof width === "number" ? `${width}px` : width;
18716
+ const applyDragWidth = (next) => {
18717
+ var _a;
18718
+ const min = ((_a = resizeRef.current) == null ? void 0 : _a.min) ?? resolveMinWidth(width);
18719
+ const clamped = Math.max(min ?? next, Math.min(next, window.innerWidth / 2));
18720
+ setDragWidth(clamped);
18721
+ if (resizeRef.current) resizeRef.current.applied = clamped;
18722
+ return clamped;
18723
+ };
18724
+ const handleResizeDown = (e) => {
18725
+ var _a;
18726
+ if (e.button !== 0) return;
18727
+ const startWidth = ((_a = panelRef.current) == null ? void 0 : _a.getBoundingClientRect().width) ?? 0;
18728
+ resizeRef.current = { startX: e.clientX, startWidth, min: resolveMinWidth(width), applied: startWidth };
18729
+ setResizing(true);
18730
+ e.currentTarget.setPointerCapture(e.pointerId);
18731
+ document.body.style.userSelect = "none";
18732
+ document.body.style.cursor = "col-resize";
18733
+ };
18734
+ const handleResizeMove = (e) => {
18735
+ const st = resizeRef.current;
18736
+ if (!st) return;
18737
+ applyDragWidth(st.startWidth + (e.clientX - st.startX));
18738
+ };
18739
+ const handleResizeEnd = (e) => {
18740
+ const st = resizeRef.current;
18741
+ if (!st) return;
18742
+ resizeRef.current = null;
18743
+ setResizing(false);
18744
+ if (e.currentTarget.hasPointerCapture(e.pointerId)) e.currentTarget.releasePointerCapture(e.pointerId);
18745
+ document.body.style.userSelect = "";
18746
+ document.body.style.cursor = "";
18747
+ onWidthChange == null ? void 0 : onWidthChange(st.applied);
18748
+ };
18749
+ const handleResizeKeyDown = (e) => {
18750
+ var _a;
18751
+ if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
18752
+ e.preventDefault();
18753
+ const current = dragWidth ?? ((_a = panelRef.current) == null ? void 0 : _a.getBoundingClientRect().width) ?? 0;
18754
+ const clamped = applyDragWidth(current + (e.key === "ArrowRight" ? RESIZE_KEY_STEP : -RESIZE_KEY_STEP));
18755
+ onWidthChange == null ? void 0 : onWidthChange(clamped);
18756
+ };
18689
18757
  const [input, setInput] = useState("");
18690
18758
  const scrollRef = useRef(null);
18691
18759
  const inputRef = useRef(null);
@@ -18715,171 +18783,198 @@ const BottomChatPanel = (props) => {
18715
18783
  };
18716
18784
  return (
18717
18785
  /* 流内常驻块:左侧竖版面板,高度撑满宿主槽位(h-full),宽度参与动画 */
18718
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18786
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
18719
18787
  motion.div,
18720
18788
  {
18789
+ ref: panelRef,
18721
18790
  initial: false,
18722
18791
  animate: { width: expandedOpen ? panelWidth : `${COLLAPSED_WIDTH}px` },
18723
- transition: { duration: 0.24, ease: "easeOut" },
18792
+ transition: { duration: resizing ? 0 : 0.24, ease: "easeOut" },
18724
18793
  className: "relative h-full shrink-0 overflow-hidden border-r border-slate-200/90 bg-white",
18725
- children: expandedOpen ? (
18726
- /* ==================== 展开态:完整侧栏面板(内容固定宽,动画期随外层裁剪显露) ==================== */
18727
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { width: panelWidth }, className: "flex h-full flex-col", children: [
18728
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex shrink-0 items-center gap-2.5 px-3.5 py-3", children: [
18729
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "h-9 w-9 shrink-0 overflow-hidden rounded-full ring-1 ring-primary/15", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: COOKIE_AVATAR, alt: "", className: "h-full w-full object-cover" }) }),
18730
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "min-w-0 flex-1 truncate text-[13px] font-black text-slate-800", children: "饼干 · AI 学伴" }),
18731
- collapsible && /* @__PURE__ */ jsxRuntimeExports.jsx(
18732
- "button",
18794
+ children: [
18795
+ expandedOpen ? (
18796
+ /* ==================== 展开态:完整侧栏面板(内容固定宽,动画期随外层裁剪显露) ==================== */
18797
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { width: panelWidth }, className: "flex h-full flex-col", children: [
18798
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex shrink-0 items-center gap-2.5 px-3.5 py-3", children: [
18799
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "h-9 w-9 shrink-0 overflow-hidden rounded-full ring-1 ring-primary/15", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: COOKIE_AVATAR, alt: "", className: "h-full w-full object-cover" }) }),
18800
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "min-w-0 flex-1 truncate text-[13px] font-black text-slate-800", children: "饼干 · AI 学伴" }),
18801
+ collapsible && /* @__PURE__ */ jsxRuntimeExports.jsx(
18802
+ "button",
18803
+ {
18804
+ type: "button",
18805
+ onClick: () => onOpenChange(false),
18806
+ title: "收起为窄条",
18807
+ "aria-label": "收起 AI 学伴面板",
18808
+ className: "shrink-0 rounded-lg p-1.5 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600",
18809
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(PanelLeftClose, { className: "h-4 w-4" })
18810
+ }
18811
+ )
18812
+ ] }),
18813
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18814
+ "div",
18733
18815
  {
18734
- type: "button",
18735
- onClick: () => onOpenChange(false),
18736
- title: "收起为窄条",
18737
- "aria-label": "收起 AI 学伴面板",
18738
- className: "shrink-0 rounded-lg p-1.5 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600",
18739
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(PanelLeftClose, { className: "h-4 w-4" })
18816
+ ref: scrollRef,
18817
+ className: "no-scrollbar min-h-0 flex-1 space-y-3 overflow-y-auto px-3.5 pb-2 pt-1",
18818
+ children: messages.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2.5 pt-1", children: [
18819
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18820
+ "img",
18821
+ {
18822
+ src: COOKIE_AVATAR,
18823
+ alt: "",
18824
+ "aria-hidden": true,
18825
+ className: "mt-0.5 h-7 w-7 shrink-0 rounded-full object-cover ring-1 ring-primary/15"
18826
+ }
18827
+ ),
18828
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "rounded-2xl rounded-tl-md bg-slate-100 px-3.5 py-2.5 text-[12px] font-bold leading-relaxed text-slate-600", children: "想怎么调整?或者有问题都可以问我~" })
18829
+ ] }) : (
18830
+ /* 消息渲染与主聊天统一,全部由 MessageContent 组件承载 */
18831
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18832
+ MessageContent$1,
18833
+ {
18834
+ messages,
18835
+ answerIsDone,
18836
+ isDev,
18837
+ userInfo,
18838
+ handleSend: ({ input: input2 }) => onSend(input2),
18839
+ customDiffViewer
18840
+ }
18841
+ )
18842
+ )
18740
18843
  }
18741
- )
18742
- ] }),
18743
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18744
- "div",
18844
+ ),
18845
+ quote && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 px-3.5 pb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 rounded-xl bg-primary/5 px-3 py-2", children: [
18846
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Paperclip, { className: "h-3 w-3 shrink-0 text-primary" }),
18847
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 text-[10px] font-black text-primary", children: "引用" }),
18848
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "min-w-0 flex-1 truncate text-[11px] font-bold text-slate-600", children: [
18849
+ '"',
18850
+ quote,
18851
+ '"'
18852
+ ] }),
18853
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18854
+ "button",
18855
+ {
18856
+ type: "button",
18857
+ onClick: onClearQuote,
18858
+ "aria-label": "取消引用",
18859
+ className: "shrink-0 rounded-md p-0.5 text-slate-400 transition-colors hover:text-rose-500",
18860
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3.5 w-3.5" })
18861
+ }
18862
+ )
18863
+ ] }) }),
18864
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "shrink-0 px-3.5 pb-2", children: [
18865
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-2 text-[10px] font-black uppercase tracking-widest text-muted-foreground", children: "你可以" }),
18866
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-1.5", children: (quote ? QUOTE_CHIPS : GENERAL_CHIPS).map((c) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
18867
+ "button",
18868
+ {
18869
+ type: "button",
18870
+ onClick: () => handleChipClick(c),
18871
+ className: "flex items-center gap-2 rounded-xl bg-slate-50 px-2.5 py-1.5 text-[11px] font-bold text-slate-600 ring-1 ring-slate-200/70 transition-colors hover:bg-primary-50 hover:text-primary",
18872
+ children: [
18873
+ /* @__PURE__ */ jsxRuntimeExports.jsx(c.icon, { className: "h-3.5 w-3.5 shrink-0" }),
18874
+ c.label
18875
+ ]
18876
+ },
18877
+ c.label
18878
+ )) })
18879
+ ] }),
18880
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 px-3.5 pb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-2xl bg-slate-50 p-1.5 ring-1 ring-slate-200/80 transition-shadow focus-within:bg-white focus-within:ring-2 focus-within:ring-primary/30", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-end gap-1.5", children: [
18881
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18882
+ "input",
18883
+ {
18884
+ ref: inputRef,
18885
+ value: input,
18886
+ onChange: (e) => setInput(e.target.value),
18887
+ onKeyDown: (e) => {
18888
+ if (e.key !== "Enter") return;
18889
+ if (e.shiftKey) return;
18890
+ submit();
18891
+ },
18892
+ placeholder: quote ? "针对这段提问,或说想怎么改..." : "描述你想怎么调,或问我任何问题...",
18893
+ "aria-label": "输入你想问的问题或想做的调整",
18894
+ className: "h-9 w-full border-0 bg-transparent px-2.5 text-[12px] font-bold outline-none placeholder:font-bold placeholder:text-slate-400"
18895
+ }
18896
+ ),
18897
+ !answerIsDone && onStopAnswer ? /* @__PURE__ */ jsxRuntimeExports.jsx(
18898
+ "button",
18899
+ {
18900
+ type: "button",
18901
+ onClick: onStopAnswer,
18902
+ title: "停止回答",
18903
+ "aria-label": "停止回答",
18904
+ className: "h-9 w-9 shrink-0 rounded-xl bg-primary text-white shadow-glow transition-all hover:bg-primary/80",
18905
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(StopCircle, { className: "mx-auto h-4 w-4" })
18906
+ }
18907
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
18908
+ "button",
18909
+ {
18910
+ type: "button",
18911
+ onClick: submit,
18912
+ disabled: !input.trim(),
18913
+ "aria-label": "发送",
18914
+ className: "h-9 w-9 shrink-0 rounded-xl bg-primary text-white shadow-glow transition-all hover:bg-primary-700 disabled:bg-slate-200 disabled:text-slate-400 disabled:shadow-none",
18915
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Send, { className: "mx-auto h-4 w-4" })
18916
+ }
18917
+ )
18918
+ ] }) }) })
18919
+ ] })
18920
+ ) : (
18921
+ /* ==================== 收起态:左侧窄竖条把手(仍在布局内占位) ==================== */
18922
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
18923
+ "button",
18745
18924
  {
18746
- ref: scrollRef,
18747
- className: "no-scrollbar min-h-0 flex-1 space-y-3 overflow-y-auto px-3.5 pb-2 pt-1",
18748
- children: messages.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2.5 pt-1", children: [
18925
+ type: "button",
18926
+ onClick: () => onOpenChange(true),
18927
+ title: dockHint(state),
18928
+ "aria-label": "展开 AI 学伴面板",
18929
+ className: "flex h-full w-[52px] flex-col items-center gap-3 py-3 transition-colors hover:bg-slate-50",
18930
+ children: [
18749
18931
  /* @__PURE__ */ jsxRuntimeExports.jsx(
18750
18932
  "img",
18751
18933
  {
18752
18934
  src: COOKIE_AVATAR,
18753
18935
  alt: "",
18754
18936
  "aria-hidden": true,
18755
- className: "mt-0.5 h-7 w-7 shrink-0 rounded-full object-cover ring-1 ring-primary/15"
18937
+ className: "h-9 w-9 shrink-0 rounded-full object-cover ring-1 ring-primary/15"
18756
18938
  }
18757
18939
  ),
18758
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "rounded-2xl rounded-tl-md bg-slate-100 px-3.5 py-2.5 text-[12px] font-bold leading-relaxed text-slate-600", children: "想怎么调整?或者有问题都可以问我~" })
18759
- ] }) : (
18760
- /* 消息渲染与主聊天统一,全部由 MessageContent 组件承载 */
18940
+ /* @__PURE__ */ jsxRuntimeExports.jsx(PanelLeftOpen, { className: "h-4 w-4 shrink-0 text-slate-400" }),
18761
18941
  /* @__PURE__ */ jsxRuntimeExports.jsx(
18762
- MessageContent$1,
18942
+ "span",
18763
18943
  {
18764
- messages,
18765
- answerIsDone,
18766
- isDev,
18767
- userInfo,
18768
- handleSend: ({ input: input2 }) => onSend(input2),
18769
- customDiffViewer
18944
+ className: "text-[11px] font-black tracking-widest text-slate-500",
18945
+ style: { writingMode: "vertical-rl" },
18946
+ children: "饼干 · AI 学伴"
18770
18947
  }
18771
18948
  )
18772
- )
18949
+ ]
18773
18950
  }
18774
- ),
18775
- quote && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 px-3.5 pb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 rounded-xl bg-primary/5 px-3 py-2", children: [
18776
- /* @__PURE__ */ jsxRuntimeExports.jsx(Paperclip, { className: "h-3 w-3 shrink-0 text-primary" }),
18777
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 text-[10px] font-black text-primary", children: "引用" }),
18778
- /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "min-w-0 flex-1 truncate text-[11px] font-bold text-slate-600", children: [
18779
- '"',
18780
- quote,
18781
- '"'
18782
- ] }),
18783
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18784
- "button",
18785
- {
18786
- type: "button",
18787
- onClick: onClearQuote,
18788
- "aria-label": "取消引用",
18789
- className: "shrink-0 rounded-md p-0.5 text-slate-400 transition-colors hover:text-rose-500",
18790
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3.5 w-3.5" })
18791
- }
18792
- )
18793
- ] }) }),
18794
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "shrink-0 px-3.5 pb-2", children: [
18795
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-2 text-[10px] font-black uppercase tracking-widest text-muted-foreground", children: "你可以" }),
18796
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 gap-1.5", children: (quote ? QUOTE_CHIPS : GENERAL_CHIPS).map((c) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
18797
- "button",
18798
- {
18799
- type: "button",
18800
- onClick: () => handleChipClick(c),
18801
- className: "flex items-center gap-2 rounded-xl bg-slate-50 px-2.5 py-1.5 text-[11px] font-bold text-slate-600 ring-1 ring-slate-200/70 transition-colors hover:bg-primary-50 hover:text-primary",
18802
- children: [
18803
- /* @__PURE__ */ jsxRuntimeExports.jsx(c.icon, { className: "h-3.5 w-3.5 shrink-0" }),
18804
- c.label
18805
- ]
18806
- },
18807
- c.label
18808
- )) })
18809
- ] }),
18810
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 px-3.5 pb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-2xl bg-slate-50 p-1.5 ring-1 ring-slate-200/80 transition-shadow focus-within:bg-white focus-within:ring-2 focus-within:ring-primary/30", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-end gap-1.5", children: [
18811
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18812
- "input",
18813
- {
18814
- ref: inputRef,
18815
- value: input,
18816
- onChange: (e) => setInput(e.target.value),
18817
- onKeyDown: (e) => {
18818
- if (e.key !== "Enter") return;
18819
- if (e.shiftKey) return;
18820
- submit();
18821
- },
18822
- placeholder: quote ? "针对这段提问,或说想怎么改..." : "描述你想怎么调,或问我任何问题...",
18823
- "aria-label": "输入你想问的问题或想做的调整",
18824
- className: "h-9 w-full border-0 bg-transparent px-2.5 text-[12px] font-bold outline-none placeholder:font-bold placeholder:text-slate-400"
18825
- }
18826
- ),
18827
- !answerIsDone && onStopAnswer ? /* @__PURE__ */ jsxRuntimeExports.jsx(
18828
- "button",
18829
- {
18830
- type: "button",
18831
- onClick: onStopAnswer,
18832
- title: "停止回答",
18833
- "aria-label": "停止回答",
18834
- className: "h-9 w-9 shrink-0 rounded-xl bg-primary text-white shadow-glow transition-all hover:bg-primary/80",
18835
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(StopCircle, { className: "mx-auto h-4 w-4" })
18836
- }
18837
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
18838
- "button",
18951
+ )
18952
+ ),
18953
+ expandedOpen && resizable && /* ==================== 右缘拖拽把手:4px 命中区,hover/拖动/聚焦竖条转主题色 ==================== */
18954
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18955
+ "div",
18956
+ {
18957
+ role: "separator",
18958
+ "aria-orientation": "vertical",
18959
+ "aria-label": "拖拽调整 AI 学伴面板宽度",
18960
+ title: "拖拽调整面板宽度",
18961
+ tabIndex: 0,
18962
+ className: "group absolute inset-y-0 right-0 z-10 w-1 cursor-col-resize outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
18963
+ onPointerDown: handleResizeDown,
18964
+ onPointerMove: handleResizeMove,
18965
+ onPointerUp: handleResizeEnd,
18966
+ onPointerCancel: handleResizeEnd,
18967
+ onKeyDown: handleResizeKeyDown,
18968
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
18969
+ "span",
18839
18970
  {
18840
- type: "button",
18841
- onClick: submit,
18842
- disabled: !input.trim(),
18843
- "aria-label": "发送",
18844
- className: "h-9 w-9 shrink-0 rounded-xl bg-primary text-white shadow-glow transition-all hover:bg-primary-700 disabled:bg-slate-200 disabled:text-slate-400 disabled:shadow-none",
18845
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Send, { className: "mx-auto h-4 w-4" })
18971
+ "aria-hidden": true,
18972
+ className: `absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 rounded-full transition-colors ${resizing ? "bg-primary" : "bg-slate-200 group-hover:bg-primary/70 group-focus-visible:bg-primary/70"}`
18846
18973
  }
18847
18974
  )
18848
- ] }) }) })
18849
- ] })
18850
- ) : (
18851
- /* ==================== 收起态:左侧窄竖条把手(仍在布局内占位) ==================== */
18852
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
18853
- "button",
18854
- {
18855
- type: "button",
18856
- onClick: () => onOpenChange(true),
18857
- title: dockHint(state),
18858
- "aria-label": "展开 AI 学伴面板",
18859
- className: "flex h-full w-[52px] flex-col items-center gap-3 py-3 transition-colors hover:bg-slate-50",
18860
- children: [
18861
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18862
- "img",
18863
- {
18864
- src: COOKIE_AVATAR,
18865
- alt: "",
18866
- "aria-hidden": true,
18867
- className: "h-9 w-9 shrink-0 rounded-full object-cover ring-1 ring-primary/15"
18868
- }
18869
- ),
18870
- /* @__PURE__ */ jsxRuntimeExports.jsx(PanelLeftOpen, { className: "h-4 w-4 shrink-0 text-slate-400" }),
18871
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18872
- "span",
18873
- {
18874
- className: "text-[11px] font-black tracking-widest text-slate-500",
18875
- style: { writingMode: "vertical-rl" },
18876
- children: "饼干 · AI 学伴"
18877
- }
18878
- )
18879
- ]
18880
18975
  }
18881
18976
  )
18882
- )
18977
+ ]
18883
18978
  }
18884
18979
  )
18885
18980
  );
Binary file
Binary file