makecindy / makecindy/cindy

bug: 「用 AI 重新命名」空会话静默失败只弹“请稍后重试”,deepseek 等无 titleModel 的 provider 上该功能始终不可用

Open
#2,046 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

**客户端版本**: 0.1.35
**反馈类型**: bug

---

## 现象 / What happened

重命名输入框的「用 AI 重新命名」(Magic/Sparkles)按钮在两类场景下失败,且提示无区分度:

1. 目标会话还没有任何可用对话素材(新建空会话/草稿、或首轮消息仍在途)时,点击后立即弹出「AI 命名失败,请稍后重试」,主进程日志中没有任何记录——失败路径被静默吞掉(直接 `return null`)。
2. 内置 provider 清单只为 anthropic / openai 配置了 `titleModel`,deepseek 等 provider 即使会话有完整对话,AI 命名也必然失败(one-shot 仅打 DEBUG `skipped: no title target`),自动起名则永远退回「消息前 40 字」启发式占位。

## 复现步骤 / Steps to reproduce

1. 新建一个会话,不发送任何消息(或只发纯附件/图片消息)。
2. 双击会话标题进入重命名,点击「用 AI 重新命名」✨。
3. 立即弹出「AI 命名失败,请稍后重试」;查看 `logs/main-.log`,无任何 `regenerate` / `auto-title` / `title` 相关记录。
4. 在 deepseek 提供商的有内容会话上重复操作:同样失败,日志仅出现 DEBUG `title oneShot skipped: no title target { providerId: 'deepseek' }`。

## 期望行为 / Expected behavior

- 空会话/无素材时给出可操作的提示(如「会话还没有可命名内容,发送消息后再试」),而不是笼统的「AI 命名失败」。
- 对未配置 titleModel 的 provider(deepseek 等),按钮应禁用或明确提示「当前模型暂不支持 AI 命名」;或补齐 titleModel 支持。
- 失败路径应保留可诊断日志,当前静默 null 导致线上完全无法定位。

## 实际行为 / Actual behavior

- 空会话点击:`maker:regenerate-title` → `regenerateMakerSessionTitle` 读素材为空时直接 `return null`(无日志),renderer 统一 toast「AI 命名失败,请稍后重试」。
- deepseek 会话:`buildTitleTarget` 未匹配任何内置分支 → `return null`,one-shot 只留 DEBUG 记录,最终同样返回 null 弹提示。

## 根因分析 / Root cause

- 空素材静默失败:`apps/desktop/src/main/maker-ipc/title.ts` 的 `regenerateMakerSessionTitle` 中 `recent.length === 0` 时直接 `return null`,不写任何日志;调用方 `apps/desktop/src/renderer/features/cc-agent/SessionRenameInput.tsx` 的 `handleAiRename` 对 `title: null` 统一走「AI 命名失败」toast,用户无法区分「没有内容可命名」与「生成失败」。
- provider 支持缺失:`packages/model-providers/src/builtin.ts` 仅 anthropic(claude-haiku-4-5)与 openai(gpt-5.4-mini)声明了 `titleModel`;`apps/desktop/src/main/maker-host/title-one-shot.ts` 的 `buildTitleTarget` 对未列出的 provider 落入 `default: return null`。deepseek 是常用提供商,因此该功能对它实际不可用。

## 日志证据 / Log evidence(已脱敏)

- 当日 `maker-host:title-one-shot` 记录:12 次 `skipped: no title target`(均为 deepseek)+ 2 次 `done`(openai / gpt-5.4-mini,成功)。
- 空会话点击场景:主进程日志零记录(搜 `regenerate`、`maker-ipc/title`、`SessionRenameInput` 均无命中),符合静默 null 路径。
- 失败链路:`maker:regenerate-title` → `regenerateMakerSessionTitle` → `return null` → renderer 弹「AI 命名失败,请稍后重试」。

## 建议 / Suggested fix

1. 拆分失败语义:空素材 / provider 不支持 / 模型输出不合规分别给出不同提示与日志。
2. 为 deepseek 等常用 provider 配置 `titleModel`,或把标题模型选择做成可扩展配置。
3. 静默 `return null` 路径至少补一条 warn 日志(注意脱敏,不记录用户消息内容)。
---
**OS**: win32 x64 (10.0.26200)
**界面语言**: zh-CN

Contributor guide

Open the contributing guide

Research direction

Read apps/desktop/src/main/maker-ipc/title.ts and apps/desktop/src/renderer/features/cc-agent/SessionRenameInput.tsx to trace empty-session results into the rename toast. Then inspect packages/model-providers/src/builtin.ts and apps/desktop/src/main/maker-host/title-one-shot.ts for provider title targets. Done means empty content, unsupported providers, and generation failures have distinct user feedback and diagnostic logging, with supported providers working.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, typescript
Domain
ai, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.