Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ OSS 文件接口。前端业务接口需要可用的后端服务。

## 界面语言

Admin 与 Chat 使用各自的 Vue I18n 实例,支持简体中文、繁体中文和英文。
Admin 与 Chat 使用独立 Vue I18n 实例,内置简体、繁体和英文,并支持部署外置语言包。
语言状态、已接入范围及语言包分类见 [国际化规则](src/locales/LOCALE_README.md),不在业务代码保存翻译后的协议值。

## 开发规则
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/COMPONENT_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Admin、Chat 共用的 `App.vue` 通过 Config Provider 的 `table.tooltipOption

位于 `global/markdown-editor/`,底层 Props、事件通过 `$attrs` 透传;默认语言读取当前应用的 Vue I18n 全局实例,
不直接依赖 Admin 或 Chat Store。语言切换只更新 language 属性,不重建编辑器或改写正文;
通过既有 language 属性仍可显式覆盖。繁体 zh-Hant 映射到已注册的 zh-TW 语言包。
language 属性可显式覆盖;繁体 zh-Hant 映射为 zh-TW,外置语言缺少编辑器语言包时回退默认语言。

- `MdEditor` 默认关闭 Prettier,提供 `defFooters` 插槽。
- `MdEditorMagnify` 接收字符串 `v-model` 和 `title`,弹窗确认后回写并触发 `submitDialog`;
Expand Down
61 changes: 32 additions & 29 deletions ui/src/locales/LOCALE_README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 国际化规则

本文维护 `src/locales` 的目录、命名空间、文案归属和使用规则。当前支持 `zh-CN`、`zh-Hant`、`en-US`,默认语言及缺失文案回退为简体中文。
本文维护 `src/locales` 的目录、命名空间、文案归属和使用规则。内置 `zh-CN`、`zh-Hant`、`en-US`,支持部署外置语言包;默认语言及缺失文案回退为简体中文。
文档描述当前实现,不作为翻译进度清单;页面行为、组件接口和画布协议分别见 [页面规则](../views/VIEW_README.md)、[组件规则](../components/COMPONENT_README.md)、[工作流规则](../workflow-canvas/WORKFLOW_README.md)。

## 目录与命名空间
Expand Down Expand Up @@ -64,6 +64,15 @@
- 同一命名空间的不同文件不得重复定义 JSON 顶层字段;加载采用浅合并,不会深层合并同名对象。拆文件应搬完整分组,保持调用 key 不变。
- Vite 自动收集语言文件,新增或移动文件不逐项维护 import,不增加加载辅助函数。

### 外置语言包

入口初始化后异步加载外置语言,Admin 使用 /static/admin/locales,Chat 使用 /static/chat/locales。
index.json 的 locales 数组列出语言代码;各 <locale>.json 使用最终命名空间组织 messages,顶层 lang 为显示名称,
不进入译文。仅注册合法代码的对象包,内置语言代码被过滤;索引失败不影响内置语言,单包失败跳过。
加载成功后合并译文并更新响应式 LOCALE_OPTIONS,重复注册只更新名称。
语言代码按 BCP 47 规范化,先匹配已注册语言,再匹配英语/中文变体或唯一同语言族;
加载完成后未注册的语言回退 zh-CN。Markdown 无对应包时使用默认语言,不假定编辑器也支持外置语言。

## Key 结构与排序

翻译 key 最多四层,包含命名空间。使用表达业务含义的英文 camelCase,不使用中文、数字序号或 `misc` 等模糊分类。
Expand Down Expand Up @@ -152,49 +161,43 @@

## 文案硬性规范

以下规则适用于所有业务页面、共享组件和工作流界面,新增及整理现有翻译时必须遵守。
本节列明的操作确认句和通用确认按钮按以下规范统一;其他文案仍须保留原有名称和含义,不得借统一规范擅自改写。
适用于页面、共享组件和工作流;只统一下列已有确认文案,不新增确认流程或改写其他业务含义。
确认句完整存入所属业务域并直接调用 t(),名称和数量用 {name}、{count} 传入,保持原数据来源。
三语使用相同插值参数;中文使用全角冒号和问号,不在名称、数量旁加空格。繁体遵循简体格式,
英文使用对应语序、标点和单复数。调用方不拼接标点、不按语言分支、不新增翻译辅助函数。
风险与关联影响留在正文,不代替标题;删除、移除和解除关联保持区别。

### 删除确认

| 场景 | 简体中文固定格式 | 示例 |
| -------- | ----------------------------------------------------- | -------------------------- |
| 单个删除 | `是否删除XXX:XXX?`,依次填写对象类型、对象名称 | `是否删除文档:使用指南?` |
| 批量删除 | `是否删除选中的X个XXXX?`,依次填写所选数量、对象类型 | `是否删除选中的3个文档?` |
| 场景 | 简体固定格式 | 参数与归属 |
| ---- | --------------------------------- | ------------------------------------ |
| 单项 | 是否删除对象类型:{name}? | 实际名称;所属业务 delete 分组 |
| 批量 | 是否删除选中的{count}个对象类型? | 实际选中删除数量;同业务 delete 分组 |

- 中文使用全角冒号 `:` 和问号 `?`,对象名称、数量与固定文字之间不额外加空格;批量格式统一保留“选中的”和量词“个”。
- 对象类型使用对应业务的准确名称,单个删除展示实际对象名称,批量数量使用本次选中的删除对象数。
- 删除确认句保留在所属业务域的 `delete` 分组,完整翻译并直接调用 `t()`;名称和数量分别使用 `{name}`、`{count}` 插值,不新增翻译辅助函数,也不将不同业务拼成通用删除句。
- 三种语言保持相同含义及插值参数;繁体遵循对应中文格式,英文使用英文语序和标点。标点随完整句子维护,不在使用处按语言判断或拼接不同标点。
- 删除风险、关联影响等必要说明保留在正文,不替代上述确认句。此规则约束已有删除确认文案,不新增确认流程,也不将“移除”“解除关联”等其他操作改成删除。
对象类型使用准确业务名称,如“是否删除文档:使用指南?”;批量保留“选中的”和“个”。
不同业务各自维护完整译文,不拼成通用删除句。

### 工具更新确认

工具更新确认采用同样的单个对象格式:`是否更新工具:{name}?`,英文为 `Update tool: {name}?`,繁体为 `是否更新工具:{name}?`。
完整句子使用 `tool.updateVersion.title`,直接调用 `t('tool.updateVersion.title', { name: tool.name })`;名称保持原值,不在调用处追加冒号或问号。更新影响说明仍使用 `tool.updateVersion.description`。
tool.updateVersion.title 使用“是否更新工具:{name}?”,英文为 `Update tool: {name}?`,
繁体为“是否更新工具:{name}?”。影响说明使用同组 description。

### 文档同步确认

单个文档同步使用 `knowledge.document.sync.title`:`是否同步文档:{name}?`;批量同步使用同组 `batchTitle`:`是否同步选中的{count}个文档?`。
完整句子直接调用 `t()`,分别传入原文档名称与本次选中的文档数量;英文批量文案按数量区分 `document` / `documents`。标点随三语句子维护,不在调用处追加。同步说明及工作流文档的专属说明仍归同组,保留原同步流程。
knowledge.document.sync.title 使用“是否同步文档:{name}?”,同组 batchTitle 使用
“是否同步选中的{count}个文档?”。英文按数量区分 document/documents;同步及工作流专属说明留在同组,流程不变。

### 成员移除确认

单个成员移除使用 `system.member.removeTitle`:`是否移除成员:{name}?`;按成员数量批量移除使用 `system.member.batchRemoveTitle`:`是否移除选中的{count}个成员?`。
用户组、对话用户组、角色和工作空间复用单个标题;按人数批量移除时传入实际人数,英文区分 `member` / `members`。完整句子直接调用 `t()`,名称和数量保持原有来源,调用处不再追加标点。
工作空间按记录批量移除使用 `workspace.delete.batchRemoveTitle` 的完整问句“是否移除选中记录对应的成员?”,保留记录与成员的区别;人数和记录数继续由 `batchRemoveDescription` 分别说明,计数及移除逻辑保持原样。
system.member.removeTitle 使用“是否移除成员:{name}?”,用户组、对话用户组、角色和工作空间共用。
batchRemoveTitle 使用“是否移除选中的{count}个成员?”,按实际人数传值,英文区分 member/members。
工作空间按记录移除使用 workspace.delete.batchRemoveTitle:“是否移除选中记录对应的成员?”。
人数与记录数由 batchRemoveDescription 分别说明,不改变计数和移除逻辑。

### 确认按钮

通用确认按钮统一使用 `common.actions.comfirm`,不再区分“确认”和“确定”,不另建同义 key。

| 语言 | 固定文案 |
| --------- | -------- |
| `zh-CN` | `确定` |
| `zh-Hant` | `確定` |
| `en-US` | `Ok` |

英文必须为首字母大写的 `Ok`,不使用 `OK`、`ok` 或 `Confirm`。此规则限定独立的通用确认按钮,不改写“确认密码”等业务字段,也不将“删除”“保存”等明确动作按钮改成通用确认按钮。
独立的通用确认按钮只使用 common.actions.comfirm:简体“确定”、繁体“確定”、英文 `Ok`。
不增加同义 key,不使用 `OK`、`ok` 或 `Confirm`;“确认密码”等字段及“删除”“保存”等明确动作保持原文案。

## 使用约定

Expand Down Expand Up @@ -237,7 +240,7 @@ Chat(单应用与门户)不读写浏览器语言缓存,初始化使用浏
加载当前对话用户档案后,优先应用账号 language;档案未提供语言时保留当前语言。
Chat 入口调用 `createAppI18n(user, null)`,不监听浏览器语言缓存变化。
英语变体归一为 en-US;zh-Hant、zh-TW、zh-HK、zh-MO 归一为 zh-Hant,
显式 zh-Hans 优先使用简体,其余语言回退 zh-CN。Element Plus 的繁体映射为 zh-tw。
显式 zh-Hans 优先使用简体;其他语言按上述外置包注册与回退规则解析。Element Plus 的繁体映射为 zh-tw。
Admin 跨标签页同步 MaxKB-locale 的变化。请求头复用原请求层的 user.language。
登录前的语言选择在 Admin 保存到浏览器缓存,在 Chat 仅更新当前内存状态;头部菜单调用当前账号语言接口,
成功后同步 Store 和用户档案,Admin 同时更新本地偏好,不刷新页面。Admin 和 Chat 后续加载账号时继续采用已保存的账号语言。
Expand Down
5 changes: 2 additions & 3 deletions ui/src/utils/UTILS_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ isWorkspaceResource 仅匹配 workspace,不包含 workspace-shared;未配置

## VNode 插槽内容判断

组件需要根据插槽是否存在真实渲染内容决定是否显示触发器或操作区时,使用
`vnode.ts` 导出的 `hasRenderableSlotContent()`。该函数会递归检查 Fragment,并忽略空白文本、
注释和空 Fragment;不要仅通过 `$slots.xxx` 判断带 `v-if` 的条件插槽是否有可见内容。
按插槽可见内容决定入口显隐时,使用 vnode.ts 的 hasRenderableSlotContent()。
它递归检查 Fragment,忽略空白、注释和空 Fragment;不能仅用 $slots.xxx 判断条件插槽是否可见。

## 消息提示

Expand Down
4 changes: 3 additions & 1 deletion ui/src/workflow-canvas/WORKFLOW_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,12 @@ MkFormList 的排序、增删均以 `cloneDeep` 回写;MkTable 保留普通行
文件类型图标复用 `@/utils/icon` 的 `getFileIconUrl`。
所有节点执行详情的内容区统一使用 `mk-gray-card-sm` 卡片和 `h6.mb-2` 标题,
标题与正文之间不加分隔线,内容列表使用 8px 间距。展示标签后的冒号统一使用中文 `:`,
不替换实际数据、URL 或代码中的冒号。各模式保留原有字段、显隐条件和专属交互;
不替换实际数据、URL 或代码中的冒号。除下述展示约定外,各模式保留原有字段、显隐条件和专属交互;
检索段落、文档分段等白底子卡片保留层级及元信息分隔线,不引入独立的区块组件。
只读 Markdown 回答复用全局 `MdPreview`,透明背景与自适应高度由全局预览样式统一提供,
节点不重复添加局部覆盖或固定 `editor-id`。
AI 对话、图片理解、视频理解、图片生成、图生视频和文生视频的 AI 回答区域使用 `el-scrollbar`,
最大高度为 500px。AI 对话、图片理解和视频理解的应用与知识库模式详情均隐藏思考过程。

循环详情是唯一递归点,负责循环设置和轮次选择,将选中轮次的子节点交给 `ExecutionDetailContent` 排序、分发,
并传 `show-content-on-error`,允许整体失败时查看已执行子节点。递归数据不得包含循环自身;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,20 @@ defineProps<{
</div>

<!-- 思考过程 -->
<div class="mk-gray-card-sm">
<!-- <div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.thinking.process') }}</h6>
<div class="whitespace-pre-wrap">
{{ data.reasoning_content || '-' }}
</div>
</div>
</div> -->

<!-- AI 回答 -->
<div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.answer.aiLabel') }}</h6>
<div>
<el-scrollbar max-height="500" class="-mr-3" view-class="pr-3">
<MdPreview v-if="data.answer" :model-value="data.answer" noImgZoomIn />
<template v-else>-</template>
</div>
</el-scrollbar>
</div>
</DetailContainer>
</template>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is my review of the diff:

Potential Issues

  1. Commented-out "thinking process" block left in code

    • Instead of commenting out the entire div, it's cleaner to delete it (or gate it with v-if="false" / a feature flag). Dead commented markup is a maintenance smell and may confuse reviewers.
    • If you intend to re-enable it later, add a comment explaining why it's disabled (e.g., <!-- Disabled: reasoning_content temporarily hidden -->).
  2. el-scrollbar requires Element Plus import/registration

    • Ensure ElScrollbar is globally registered or explicitly imported. If this component is tree-shaken, an unresolved <el-scrollbar> will fail silently or warn at runtime.
  3. max-height="500" unit ambiguity

    • In Element Plus, max-height accepts a number (interpreted as px) or a string with units. A bare 500 works but is less explicit. Prefer max-height="500px" for clarity and to avoid confusion across versions.
  4. Magic offset classes (-mr-3, pr-3)

    • The negative margin + compensating padding pattern is fragile. It ties layout to Tailwind spacing scale and can break if the parent container's padding changes. Consider documenting why this offset exists (scrollbar gutter compensation) or solve it via CSS on the scrollbar itself.
  5. v-else fallback with el-scrollbar

    • When data.answer is empty, the scrollbar wrapper still renders around -. That's fine functionally, but the max-height/scroll styling applies even to the trivial placeholder. Minor: consider only wrapping with el-scrollbar inside the v-if branch, e.g.:
      <el-scrollbar v-if="data.answer" max-height="500px">…</el-scrollbar>
      <template v-else>-</template>
  6. view-class="pr-3" — verify view-class is a supported prop in your installed Element Plus version (it was added around 2.2.x). If on an older version, this prop is ignored and the padding won't apply.

  7. No exponential/markdown injection concerns changed here, but confirm MdPreview sanitizes HTML when rendering data.answer (user/AI-generated content), since it's now inside a scroll viewport — no functional change, just reaffirming security.

Optimization Suggestions

  • Remove the commented-out block entirely, or replace it with a proper conditional (v-if="showReasoning && data.reasoning_content") so it can be toggled.
  • Use explicit units: max-height="500px".
  • Extract the scroll offset (-mr-3 + pr-3) into a named CSS class (e.g. .scroll-gutter) for reuse and clarity.
  • If long answers are common, consider adding always (always show scrollbar) to prevent layout shift when content grows past the max height: <el-scrollbar max-height="500px" always>.
  • Add a key or transition only if content toggles frequently; otherwise not needed.

Summary

No blocking bugs, but the primary concerns are: dead commented code, explicit units for max-height, version compatibility of view-class, and fragile negative-margin scroll gutter styling. Addressing these improves maintainability and cross-version safety.

Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,20 @@ defineProps<{
</div>

<!-- 思考过程 -->
<div class="mk-gray-card-sm">
<!-- <div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.thinking.process') }}</h6>
<div class="whitespace-pre-wrap">
{{ data.reasoning_content || '-' }}
</div>
</div>
</div> -->

<!-- AI 回答 -->
<div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.answer.aiLabel') }}</h6>
<div>
<el-scrollbar max-height="500" class="-mr-3" view-class="pr-3">
<MdPreview v-if="data.answer" :model-value="data.answer" noImgZoomIn />
<template v-else>-</template>
</div>
</el-scrollbar>
</div>
</DetailContainer>
</template>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's my review of the diff:

Issues / Observations

  1. Commented-out block left in place – The "思考过程" (thinking process) section is fully commented out rather than removed. Dead code adds noise and can drift from reality; if it's temporary, add a TODO/ticket reference. If intentional, consider deleting it (git history preserves it).

  2. No conditional hiding logic – You comment out the thinking box statically. If data.reasoning_content may or may not be present at runtime, it would be better to use v-if="data.reasoning_content" (and keep one wrapper) instead of hardcoding its absence. This keeps the UI adaptive and avoids maintaining commented code.

  3. el-scrollbar + Markdown rendering pitfalls

    • max-height="500" — confirm whether Element Plus expects a number (px) or string here; passing "500" as a string attribute becomes a string prop. Use :max-height="500" for a typed numeric value.
    • Height on a scroll container with rendered markdown: tall tables/pre/code blocks may need word-break/overflow-x handling. Verify horizontal overflow inside the scrollbar (long code lines).
    • MdPreview lazy/dynamic content can change height after mount; ensure the scrollbar recalculates (update() ref) if you programmatically set content.
  4. Class naming mismatch – -mr-3 / view-class="pr-3" uses Tailwind-style utilities. Ensure these classes exist in your build pipeline when applied both to the el-scrollbar root and to view-class (the inner wrapper). Double-check that negative margin on the outer element doesn't clip the scrollbar track.

  5. Accessibility – The scroll region has no accessible label. Consider aria-label="{{ t('workflow.answer.aiLabel') }}" or similar on the scrollable area so screen readers identify it.

  6. <template v-else>-</template> – Fine, but ensure the fallback renders inside the new el-scrollbar wrapper as intended (it does in this diff; just confirm visual alignment vs. previous plain <div>).

  7. Diff hunk header @@ -64,20 +64,20 @@ defineProps<{ – Unusual hunk context; verify the surrounding template structure (matching tags) is intact after edits, since commenting only the inner div but not checking indentation across the block could leave stray whitespace/newline differences.

Optimization suggestions

  • Prefer v-if="data.reasoning_content" over static commenting if visibility depends on data.
  • Use :max-height="500" (bind) instead of max-height="500".
  • Add always or hide-on-pause options only if needed (avoid unnecessary scrollbar chrome for short answers).
  • Extract the repeated mk-gray-card-sm card wrapper into a small component/slot if this pattern recurs.
  • If long answers are common, consider virtualization or a "show more" collapse beyond 500px for better UX.

Summary

The change itself (wrapping the answer in a scrollbar) is reasonable, but don't leave commented-out code, bind max-height numerically, and verify markdown overflow + scrollbar recalculation. Consider replacing the comment with a functional v-if.

Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ defineProps<{

<div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.answer.aiLabel') }}</h6>
<div class="space-y-2">
<el-scrollbar max-height="500" class="-mr-3" view-class="pr-3">
<MdPreview v-if="data.answer" :model-value="data.answer" noImgZoomIn />
<template v-else>-</template>
</div>
</el-scrollbar>
</div>
</DetailContainer>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ defineProps<{

<div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.answer.aiLabel') }}</h6>
<div class="space-y-2">
<el-scrollbar max-height="500" class="-mr-3" view-class="pr-3">
<MdPreview v-if="data.answer" :model-value="data.answer" noImgZoomIn />
<template v-else>-</template>
</div>
</el-scrollbar>
</div>
</DetailContainer>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ defineProps<{
</div>
</div>

<div class="mk-gray-card-sm">
<!-- <div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.thinking.process') }}</h6>
<div class="space-y-2">
<MdPreview v-if="data.reasoning_content" :model-value="data.reasoning_content" noImgZoomIn />
<template v-else>-</template>
</div>
</div>
</div> -->

<div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.answer.aiLabel') }}</h6>
<div class="space-y-2">
<el-scrollbar max-height="500" class="-mr-3" view-class="pr-3">
<MdPreview v-if="data.answer" :model-value="data.answer" noImgZoomIn />
<template v-else>-</template>
</div>
</el-scrollbar>
</div>
</DetailContainer>
</template>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Findings

1. Commented-out code left in template

The "thinking process" block is commented out rather than removed. If this is temporary, fine — but it should not be committed as dead code. Either:

  • Delete it if the feature is permanently gone, or
  • Gate it with a feature flag / v-if so it can be re-enabled cleanly.

Leaving large commented template blocks hurts maintainability and review clarity.

2. Inconsistent scroll behavior

Only the answer card now uses <el-scrollbar>; the hidden thinking process card (when re-enabled) would not. Consider extracting a reusable wrapper/component so both cards behave consistently, avoiding drift later.

3. Layout dependency on negative margin (-mr-3 + pr-3)

The -mr-3 view-class="pr-3" combo is a common pattern to hide the scrollbar gutter, but it's fragile:

  • It hardcodes Tailwind spacing scale; if container padding changes, alignment breaks.
  • It relies on Element Plus el-scrollbar internal structure (view class). This is not part of its public API contract strictly — pin the EP version or document it.
  • Recommend a scoped CSS utility instead (e.g., .hide-scrollbar-gutter) for clarity and stability.

4. max-height="500" unit omission

Element Plus accepts a number and appends px, but being explicit helps readability and avoids confusion:

<el-scrollbar max-height="500px" ...>

5. Accessibility / UX

  • Scrollable regions should ideally be keyboard-focusable. el-scrollbar content isn't focusable by default; long markdown answers may be hard to navigate for keyboard users. Consider tabindex="0" on the wrapper or verifying focus behavior.
  • No visual affordance that content is scrollable when it overflows (minor).

6. Performance consideration for MdPreview

Markdown rendering inside a scroll region is fine, but:

  • If data.answer updates frequently (streaming), re-rendering full markdown on every chunk can be costly. Confirm whether throttling/debouncing is handled upstream.
  • Also verify MdPreview doesn't query DOM dimensions per render (common source of layout thrash with scroll containers).

7. Duplication

Both cards share the same structure (mk-gray-card-sm → h6 → content w/ fallback template {{ '-' }}). Extract a small GrayCard component — reduces duplication and keeps the fallback logic in one place.

8. Minor: empty-state placement

With el-scrollbar, an empty answer shows - inside a scroll container, which may produce a slight height/scroll oddity. Confirm the empty state renders without unexpected scrollbars.


Suggested refactor sketch

<GrayCard :title="t('workflow.answer.aiLabel')">
  <el-scrollbar max-height="500px" class="hide-scrollbar-gutter" tabindex="0">
    <div class="space-y-2 pr-3">
      <MdPreview v-if="data.answer" :model-value="data.answer" noImgZoomIn />
      <template v-else>-</template>
    </div>
  </el-scrollbar>
</GrayCard>

with

.hide-scrollbar-gutter { margin-right: -0.75rem; }

Summary: Main issues are (a) dead commented code, (b) fragile negative-margin scrollbar hack tied to Tailwind scale, (c) missing accessibility/focus handling for scrollable content, and (d) duplication ripe for extraction. None are blocking, but they're worth addressing before merge.

Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ defineProps<{
</div>
</div>

<div class="mk-gray-card-sm">
<!-- <div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.thinking.process') }}</h6>
<div class="space-y-2">
<MdPreview v-if="data.reasoning_content" :model-value="data.reasoning_content" noImgZoomIn />
<template v-else>-</template>
</div>
</div>
</div> -->

<div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.answer.aiLabel') }}</h6>
<div class="space-y-2">
<el-scrollbar max-height="500" class="-mr-3" view-class="pr-3">
<MdPreview v-if="data.answer" :model-value="data.answer" noImgZoomIn />
<template v-else>-</template>
</div>
</el-scrollbar>
</div>
</DetailContainer>
</template>
4 changes: 2 additions & 2 deletions ui/src/workflow-canvas/nodes/llm-node/details/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ function formatJson(value: unknown) {
<!-- 回答内容 -->
<div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.answer.label') }}</h6>
<div>
<el-scrollbar max-height="500" class="-mr-3" view-class="pr-3">
<MdPreview v-if="data.content" :model-value="data.content" noImgZoomIn />
<template v-else>-</template>
</div>
</el-scrollbar>
</div>

<!-- 拒答内容 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ defineProps<{

<div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.answer.aiLabel') }}</h6>
<div class="space-y-2">
<el-scrollbar max-height="500" class="-mr-3" view-class="pr-3">
<MdPreview v-if="data.answer" :model-value="data.answer" noImgZoomIn />
<template v-else>-</template>
</div>
</el-scrollbar>
</div>
</DetailContainer>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ defineProps<{
</div>
</div>

<div class="mk-gray-card-sm">
<!-- <div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.thinking.process') }}</h6>
<div class="space-y-2">
<MdPreview v-if="data.reasoning_content" :model-value="data.reasoning_content" noImgZoomIn />
<template v-else>-</template>
</div>
</div>
</div> -->

<div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.answer.aiLabel') }}</h6>
<div class="space-y-2">
<el-scrollbar max-height="500" class="-mr-3" view-class="pr-3">
<MdPreview v-if="data.answer" :model-value="data.answer" noImgZoomIn />
<template v-else>-</template>
</div>
</el-scrollbar>
</div>
</DetailContainer>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ defineProps<{
</div>
</div>

<div class="mk-gray-card-sm">
<!-- <div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.thinking.process') }}</h6>
<div class="space-y-2">
<MdPreview v-if="data.reasoning_content" :model-value="data.reasoning_content" noImgZoomIn />
<template v-else>-</template>
</div>
</div>
</div> -->

<div class="mk-gray-card-sm">
<h6 class="mb-2">{{ t('workflow.answer.aiLabel') }}</h6>
<div class="space-y-2">
<el-scrollbar max-height="500" class="-mr-3" view-class="pr-3">
<MdPreview v-if="data.answer" :model-value="data.answer" noImgZoomIn />
<template v-else>-</template>
</div>
</el-scrollbar>
</div>
</DetailContainer>
</template>
Loading