Skip to content

Restore classic settings and add request compatibility - #27

Merged
LangLang03 merged 3 commits into
masterfrom
dev
Sep 6, 2026
Merged

Restore classic settings and add request compatibility#27
LangLang03 merged 3 commits into
masterfrom
dev

Conversation

@LangLang03

@LangLang03 LangLang03 commented Sep 5, 2026

Copy link
Copy Markdown
Owner

问题

#26 只恢复了设置主页和少量共用组件,进入模型、扩展、存储、SSH 等子页面后仍然存在第二套布局。同时,文件改动的接受/撤销会直接改写并重新保存对话消息,执行授权还会插入临时 pending/accepted 工具结果,可能中断工具循环并改变后续模型请求的缓存前缀。MCP 工具卡片也使用了独立的背景与间距体系;统一思考档位未经供应商兼容映射,压缩请求固定传入 off 时会向 GLM 发送不合适的档位。

修改

完整恢复设置树

  • 将设置树共用页头和页面脚手架恢复到 UI 重构前的结构:居中标题、对称操作区、底部分割线和原有内容边距。
  • 恢复模型管理与模型添加页面的提供商标签、模型卡片、表单字段、长按操作抽屉和字段间距。
  • 恢复扩展、高级功能、提示词模板、记忆、MCP、Agent 编辑器、Skill Hub 与 Skill 商店的旧版卡片和信息层级。
  • 恢复 SSH、Termux、存储管理、错误日志、主题与关于页面的原有表单、图标底板、分区卡片和操作按钮比例。
  • 保留当前 LineTheme 配色、隐藏 MCP 内部工具 ID、模型短列表高度修复、主题弹窗配色及无障碍标签。

审阅与授权不再污染对话

  • 文件改动的接受、撤销和错误信息写入本地 diff_records.raw_json,不再调用 ChatMessage.withToolReview 修改原始消息。
  • 渲染聊天时构造仅供 UI 使用的消息副本,把本地审阅状态叠加到普通工具结果和 Agent 内嵌工具结果;模型上下文和持久化消息保持原样。
  • 接受或永久允许执行时直接继续真实工具执行,不再插入空的 accepted 工具结果;等待确认时也不再插入 pending 占位结果。
  • 拒绝执行仍生成协议所需的失败工具结果,使模型工具调用链保持完整。

显示与工具细节

  • 在“输出与浏览”新增“自动展开处理”开关,并通过本地设置、ChatUiState 和时间线组件完整接入;手动收起后不会被刷新重新打开。
  • 用户消息气泡左右外边距从 28dp 收紧到 16dp。
  • 读取工具卡片读取工具声明的动作图标:网页搜索显示放大镜,查看网页显示地球。
  • MCP 工具卡片改用与读取、Shell 相同的 48dp 摘要行、图标比例和无背景样式;展开内容统一为带边框的代码结果面板,并继续使用有界滚动。

GLM 思考兼容与压缩接入

  • 新增集中式 ReasoningCompatibility,在模型请求边界把应用的统一思考档位转换为供应商可接受的值。
  • GLM 映射规则为:off/low → lowauto/medium/high → highmax → max,并在 GLM 请求中发送 thinking.type=enabled 与映射后的 reasoning_effort
  • 普通聊天、Agent 和标准上下文摘要请求通过 ModelClient 共用兼容层;绕过 ModelClient 的专用摘要路径也显式接入相同映射。
  • 上下文压缩原本固定使用的 off 在 GLM 上会转换为 low;原生 /responses/compact 路径不包含思考参数,保持服务端压缩语义。
  • 更新 1.2.8-max 更新日志。

验证

  • ./gradlew test
  • ./gradlew :app:lintDebug
  • ./gradlew :app:assembleDebug
  • 回归覆盖接受编辑不改原始消息、Agent 内嵌审阅仅影响展示副本、授权不写临时结果、自动展开尊重手动收起、网页工具图标和消息边距。
  • 新增 GLM 六档到三档的完整映射、非 GLM 档位不变、GLM 请求体与压缩请求使用兼容档位的回归测试。
  • 生成并检查 390dp 预览:完整设置树、“输出与浏览”新增开关、聊天页用户气泡、工具差异卡片与 MCP 展开卡片。

@sourcery-ai

sourcery-ai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR consistently restores the pre-redesign settings hierarchy across shared scaffolding, model management, extension/Skill Hub flows, and infrastructure pages by replacing narrow or folded layouts with classic headers, spacing, cards, forms, and fixed action rows, while keeping the current LineTheme palette and prior behavior/accessibility fixes.

Sequence diagram for classic model provider selection

sequenceDiagram
    actor User
    participant ModelAddScreenView
    participant ModelFormHelper
    participant ModelConfig

    User->>ModelAddScreenView: tap provider toggle
    ModelAddScreenView->>ModelAddScreenView: updateProviderToggles(providerRow)
    ModelAddScreenView->>ModelAddScreenView: updateBaseUrlHint()
    ModelAddScreenView->>ModelAddScreenView: renderModelIdInput()
    ModelAddScreenView->>ModelAddScreenView: updateQueryState()
    ModelAddScreenView->>ModelAddScreenView: updateSaveState()
    ModelAddScreenView->>ModelFormHelper: addToggle(providerRow, label, active, enabled, onClick)
    ModelAddScreenView->>ModelConfig: protocolForIndex(index)
Loading

Flow diagram for restored classic settings page layout

flowchart TD
    Open[Open settings subpage] --> Header[Classic centered header]
    Header --> Content[Wide content area with restored margins]
    Content --> Sections[Section cards and inline descriptions]
    Sections --> Forms[Unfolded forms and restored field spacing]
    Forms --> Actions[Fixed horizontal action rows]
    Actions --> Theme[Apply current LineTheme colors]
Loading

File-Level Changes

Change Details Files
Restored the shared settings navigation and page scaffold to the classic layout.
  • Reworked headers into compact horizontal bars with centered titles, symmetric action slots, and bottom dividers.
  • Updated scaffold and secondary-page content padding for the restored full-width hierarchy.
  • Converted affected screens from the newer surface wrapper to direct linear layouts where needed.
app/src/main/java/cn/lineai/ui/component/ScreenHeaderView.java
app/src/main/java/cn/lineai/ui/component/ScreenScaffoldView.java
app/src/main/java/cn/lineai/ui/component/AdvancedFeaturesScreenView.java
app/src/main/java/cn/lineai/ui/component/ExtensionsScreenView.java
app/src/main/java/cn/lineai/ui/component/ModelAddScreenView.java
app/src/main/java/cn/lineai/ui/component/ModelListScreenView.java
app/src/main/java/cn/lineai/ui/component/SkillHubLoginScreenView.java
app/src/main/java/cn/lineai/ui/component/SkillHubWebScreenView.java
app/src/main/java/cn/lineai/ui/component/StorageManagementScreenView.java
app/src/main/java/cn/lineai/ui/component/TermuxIntegrationScreenView.java
Reintroduced classic model-management controls and form presentation.
  • Replaced the provider picker bottom sheet with inline provider tabs while preserving protocol-switch state updates.
  • Restored provider badges, compact model metadata, classic selection styling, and the long-press action drawer appearance.
  • Adjusted shared form field dimensions, borders, label spacing, and removed the advanced-field folding behavior.
app/src/main/java/cn/lineai/ui/component/ModelAddScreenView.java
app/src/main/java/cn/lineai/ui/component/ModelListScreenView.java
app/src/main/java/cn/lineai/ui/component/ModelFormHelper.java
app/src/main/java/cn/lineai/ui/component/FormTextFieldView.java
app/src/main/java/cn/lineai/ui/component/ModelPickerDialog.java
Restored classic cards and information hierarchy across settings, extensions, Skill Hub, and editing flows.
  • Replaced shared newer card helpers with explicit icon-backed cards, badges, descriptions, chevrons, and spacing.
  • Added elevated grouped backgrounds to extension and MCP editor forms and restored icon backing surfaces.
  • Restyled Skill Hub/store heroes, result cards, action rows, and dialogs while retaining existing accessibility and content behavior.
app/src/main/java/cn/lineai/ui/component/AdvancedFeaturesScreenView.java
app/src/main/java/cn/lineai/ui/component/ExtensionsScreenView.java
app/src/main/java/cn/lineai/ui/component/AgentExtensionEditScreenView.java
app/src/main/java/cn/lineai/ui/component/McpExtensionEditScreenView.java
app/src/main/java/cn/lineai/ui/component/PromptTemplatesScreenView.java
app/src/main/java/cn/lineai/ui/component/SkillHubCenterScreenView.java
app/src/main/java/cn/lineai/ui/component/SkillHubPublishScreenView.java
app/src/main/java/cn/lineai/ui/component/SkillStoreScreenView.java
app/src/main/java/cn/lineai/ui/component/SkillStoreDetailScreenView.java
Restored classic forms, cards, and action sizing for infrastructure and informational settings pages.
  • Made SSH key fields always visible and replaced adaptive action layouts with fixed horizontal action rows.
  • Restyled storage summaries, storage rows, Termux cards, error-log controls, and about-page spacing.
  • Adjusted memory dialog presentation to use a bounded scrollable panel while preserving theme styling.
app/src/main/java/cn/lineai/ui/component/SshSettingsScreenView.java
app/src/main/java/cn/lineai/ui/component/StorageManagementScreenView.java
app/src/main/java/cn/lineai/ui/component/TermuxIntegrationScreenView.java
app/src/main/java/cn/lineai/ui/component/ErrorLogsScreenView.java
app/src/main/java/cn/lineai/ui/component/AboutScreenView.java
app/src/main/java/cn/lineai/ui/component/MemorySettingsScreenView.java
app/src/main/java/cn/lineai/ui/component/MCPSettingsScreenView.java
Updated layout tests and release documentation to reflect the restored hierarchy.
  • Changed tests to assert centered classic headers, inline provider tabs, non-folded SSH fields, restored gutters, and compact action sizing.
  • Updated the 1.2.8-max changelog to describe restoration across the complete settings tree.
  • Retained existing theme, hidden MCP tool ID, model drawer height, dialog color, and accessibility fixes.
app/src/test/java/cn/lineai/ui/component/SecondaryScreenLayoutTest.java
app/src/test/java/cn/lineai/ui/component/UiCorrectionsTest.java
update.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="app/src/main/java/cn/lineai/ui/component/SettingsSectionView.java" line_range="36-40" />
<code_context>
-        }
-        if (row.getParent() instanceof android.view.ViewGroup) {
-            ((android.view.ViewGroup) row.getParent()).removeView(row);
+        if (row != null) {
+            if (row.getParent() instanceof android.view.ViewGroup) {
+                ((android.view.ViewGroup) row.getParent()).removeView(row);
+            }
         }
         if (!divider) {
</code_context>
<issue_to_address>
**issue (bug_risk):** addRow(null, false) now passes null to LinearLayout.addView instead of returning early, which throws when an optional row is absent.

**Triggers:** When any caller supplies a null row to the public addRow API.

**Suggested fix:** Restore the early return when row is null before either addView path.

```suggestion
        if (row == null) {
            return;
        }
        if (row.getParent() instanceof android.view.ViewGroup) {
            ((android.view.ViewGroup) row.getParent()).removeView(row);
        }
```
</issue_to_address>

### Comment 2
<location path="app/src/main/java/cn/lineai/ui/component/ModelListScreenView.java" line_range="184" />
<code_context>
         TextView title = LineTheme.textMedium(context, model.getName(), LineTheme.FONT_MD, LineTheme.TEXT);
-        title.setMaxLines(2);
-        title.setEllipsize(android.text.TextUtils.TruncateAt.END);
+        title.setSingleLine(true);
         info.addView(title, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
-        TextView sub = LineTheme.text(context, provider + " / " + model.getModelId(), LineTheme.FONT_SM, LineTheme.TEXT_TERTIARY, Typeface.NORMAL);
-        sub.setMaxLines(2);
-        sub.setEllipsize(android.text.TextUtils.TruncateAt.END);
+        TextView sub = LineTheme.text(context, model.getModelId(), LineTheme.FONT_XS, LineTheme.TEXT_TERTIARY, Typeface.NORMAL);
+        sub.setSingleLine(true);
         LinearLayout.LayoutParams subParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
</code_context>
<issue_to_address>
**issue (bug_risk):** Model and SkillHub item titles are now forced to one line without ellipsis configuration, so longer names are clipped rather than displayed with the previous two-line fallback.

**Triggers:** When a model name or SkillHub skill name exceeds the available card width.

**Suggested fix:** Retain two lines with ellipsize END, or explicitly set single-line ellipsize behavior if the classic layout requires one line.

```suggestion
        title.setMaxLines(2);
        title.setEllipsize(android.text.TextUtils.TruncateAt.END);
```
</issue_to_address>

Sourcery assessment

Approval pending. 2 findings to address first.

Blocking findings: app/src/main/java/cn/lineai/ui/component/SettingsSectionView.java:40, app/src/main/java/cn/lineai/ui/component/ModelListScreenView.java:184


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment on lines +36 to 40
if (row != null) {
if (row.getParent() instanceof android.view.ViewGroup) {
((android.view.ViewGroup) row.getParent()).removeView(row);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): addRow(null, false) now passes null to LinearLayout.addView instead of returning early, which throws when an optional row is absent.

Triggers: When any caller supplies a null row to the public addRow API.

Suggested fix: Restore the early return when row is null before either addView path.

Suggested change
if (row != null) {
if (row.getParent() instanceof android.view.ViewGroup) {
((android.view.ViewGroup) row.getParent()).removeView(row);
}
}
if (row == null) {
return;
}
if (row.getParent() instanceof android.view.ViewGroup) {
((android.view.ViewGroup) row.getParent()).removeView(row);
}

TextView title = LineTheme.textMedium(context, model.getName(), LineTheme.FONT_MD, LineTheme.TEXT);
title.setMaxLines(2);
title.setEllipsize(android.text.TextUtils.TruncateAt.END);
title.setSingleLine(true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): Model and SkillHub item titles are now forced to one line without ellipsis configuration, so longer names are clipped rather than displayed with the previous two-line fallback.

Triggers: When a model name or SkillHub skill name exceeds the available card width.

Suggested fix: Retain two lines with ellipsize END, or explicitly set single-line ellipsize behavior if the classic layout requires one line.

Suggested change
title.setSingleLine(true);
title.setMaxLines(2);
title.setEllipsize(android.text.TextUtils.TruncateAt.END);

@LangLang03 LangLang03 changed the title Restore the complete classic settings hierarchy Restore classic settings and isolate tool review state Sep 5, 2026
@LangLang03 LangLang03 changed the title Restore classic settings and isolate tool review state Restore classic settings and add request compatibility Sep 5, 2026
@LangLang03
LangLang03 merged commit a648c38 into master Sep 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant