@spzxg/cli-ui 0.6.0 → 0.6.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.
@@ -22,7 +22,7 @@ export const TextBlockCard = memo(function TextBlockCard({ block, onRemove }: {
22
22
  return (
23
23
  <div className={`cli-block ${open ? "open" : ""}`}>
24
24
  <div className="cli-block-h">
25
- <span className="cli-block-ic">{block.kind === "file" ? Icon.doc() : block.kind === "context" ? Icon.board() : block.kind === "background" ? Icon.flag() : Icon.clip()}</span>
25
+ <span className="cli-block-ic">{block.kind === "file" ? Icon.doc() : block.kind === "context" || block.kind === "viewing" ? Icon.board() : block.kind === "background" ? Icon.flag() : Icon.clip()}</span>
26
26
  <span className="cli-block-name" title={block.name}>{block.name}</span>
27
27
  <span className="cli-block-meta">{fmtCount(chars)} 字 · {fmtCount(lines)} 行</span>
28
28
  <span className="cli-block-sp" />
@@ -283,9 +283,10 @@ function AttachmentStrip({ items, attachmentUrl }: { items: MsgAttachment[]; att
283
283
  }
284
284
 
285
285
  /** 用户消息正文:普通文字按 markdown 渲染,附件 / 长粘贴是可折叠卡片,很长的纯文字也折叠。 */
286
- function UserBody({ content, attachmentUrl }: { content: string; attachmentUrl?: (a: MsgAttachment) => string | null }) {
286
+ function UserBody({ content, attachmentUrl, viewing = true }: { content: string; attachmentUrl?: (a: MsgAttachment) => string | null; viewing?: boolean }) {
287
287
  const { text, attachments } = splitAttachments(content);
288
- const parts = text ? splitMessage(text) : [];
288
+ // 看板上正在看的东西(缺省随消息带上的那块):配置成不显示时转录里也不显示。
289
+ const parts = (text ? splitMessage(text) : []).filter((p) => viewing || p.kind !== "block" || p.block.kind !== "viewing");
289
290
  return (
290
291
  <>
291
292
  {parts.map((part, i) => part.kind === "block"
@@ -310,7 +311,11 @@ function LongText({ text }: { text: string }) {
310
311
  }
311
312
 
312
313
  /** 消息行的显示选项(来自组件配置)。要引用稳定,否则 memo 失效。 */
313
- export interface MessageViewOptions { timestamps: boolean; initialBadge: boolean; userLabel: string; agentName: string }
314
+ export interface MessageViewOptions {
315
+ timestamps: boolean; initialBadge: boolean; userLabel: string; agentName: string;
316
+ /** 用户消息里「看板正在看」那块显示成卡片;false = 不显示(照样发给了智能体)。缺省显示。 */
317
+ viewingBlock?: boolean;
318
+ }
314
319
  const DEFAULT_VIEW: MessageViewOptions = { timestamps: true, initialBadge: true, userLabel: "你", agentName: "智能体" };
315
320
 
316
321
  export interface MessageHandlers {
@@ -340,7 +345,7 @@ export const MessageView = memo(function MessageView({ m, initial: isInitial, hi
340
345
  <div className="msg user queued">
341
346
  <div className="who"><Avatar who="user" /> {view.userLabel}<span className="badge queued-badge">排队中</span>{time}</div>
342
347
  <div className="msg-body">
343
- <UserBody content={m.content} attachmentUrl={handlers.attachmentUrl} />
348
+ <UserBody content={m.content} attachmentUrl={handlers.attachmentUrl} viewing={view.viewingBlock} />
344
349
  {m.note && <div className="cli-queued-note">⏳ {m.note}</div>}
345
350
  {handlers.onCancelQueued && <button className="queued-x" title="从队列中移除" aria-label="从队列中移除" onClick={() => handlers.onCancelQueued!(m)}>{Icon.x()}</button>}
346
351
  </div>
@@ -388,7 +393,7 @@ export const MessageView = memo(function MessageView({ m, initial: isInitial, hi
388
393
  )}
389
394
  <div className="msg-body">
390
395
  {initial && <div className="initial-tag">{Icon.spark()} 已随项目上下文发送</div>}
391
- {isUser ? <UserBody content={m.content} attachmentUrl={handlers.attachmentUrl} /> : m.content && <Markdown>{m.content}</Markdown>}
396
+ {isUser ? <UserBody content={m.content} attachmentUrl={handlers.attachmentUrl} viewing={view.viewingBlock} /> : m.content && <Markdown>{m.content}</Markdown>}
392
397
  </div>
393
398
  </div>
394
399
  );