统一附加知识块 + 消除历史污染 + 修复 litellm MidStreamFallbackError#222
Merged
RaQiu merged 9 commits intoRTGS2017:mainfrom Feb 15, 2026
Merged
统一附加知识块 + 消除历史污染 + 修复 litellm MidStreamFallbackError#222RaQiu merged 9 commits intoRTGS2017:mainfrom
RaQiu merged 9 commits intoRTGS2017:mainfrom
Conversation
- 双 Token 架构: access_token (30min) 前端管理, refresh_token (7天) 后端持久化 - 后端 naga_auth.py: 从 Set-Cookie/body 提取 refresh_token, 持久化到 logs/.auth_session - 前端移除 REFRESH_TOKEN, 刷新走空 body (兼容旧 localStorage 迁移) - LLM 流式调用 401 自动刷新重试 - 启动进度: preloadAllViews 8s / getSessions 5s 超时 + 全局 15s 安全兜底 - health/systemConfig 加 cache-busting 防快速重启缓存 - Electron 开机自启动设置 (autoLaunch IPC) - SplashScreen 唤醒按钮添加 clickable class 修复音效 - 音频 m4a 格式兼容修复 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts: # apiserver/api_server.py
- 后端发送 auth_expired 类型 SSE 事件代替纯文本错误 - 前端 MessageView 处理 auth_expired 触发登录对话框 - naga_auth 增加 refresh 全链路日志便于排查 token 问题 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
清空 token 后在途 API 请求会收到 401 并再次触发弹窗, 添加 suppressAuthExpired 标记在重新登录流程中抑制, 登录成功/跳过后恢复。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
NagaBusiness 通过 Authorization: Bearer <token> 验证所有请求, 旧代码使用 api_key="naga-authenticated" 导致 LiteLLM 发送 假 token 到 Authorization 头 → 被 NagaBusiness 拒绝。 改为使用真实 access_token 作为 api_key,同时保留 extra_body 中的 user_token 以兼容旧版网关。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- config 引用过期: llm_service/api_server/agentic_tool_loop 改用 get_config() 动态获取,hot_reload_config 后不再使用旧对象 - 技能工坊阻塞: 3 个同步端点从 async def 改为 def,FastAPI 自动线程池执行 - 前端预加载: 视图 import 改串行 + vite optimizeDeps 预打包,避免冷启动并发风暴 - config_manager: 原子写入(tempfile+os.replace)防截断;移除破坏性 # 注释剥离; 统一 UTF-8 编码,去掉 charset_normalizer 误判 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts: # apiserver/api_server.py # frontend/src/views/ConfigView.vue
- 重构 system prompt: 所有动态内容统一到「附加知识」分隔符后, 时间信息始终注入,末尾追加收尾指令引导 LLM 回到用户问题 - 消除 user_message 污染: 删除「调度技能【X】」和「[使用技能: X]」 前缀,技能上下文完全由 system prompt 承载 - 修复 litellm MidStreamFallbackError: 禁用内部 fallback (num_retries=0), 添加 timeout/stream_timeout=120s,新增连接错误重试逻辑(最多3次) - 改善启动体验: 健康轮询失败时输出等待日志,视图预加载显示具体组件名 - memory_client 改用 naga_auth 动态 token,移除 memory_server.enabled - Live2D 控制器支持动态模型路径,TTS speak() 返回 Promise Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本次新增 (d756994)
统一附加知识块 + 消除历史污染
build_system_prompt():所有动态内容统一到━━━ 以下是附加知识 ━━━分隔符之后include_time参数),从message_manager.py迁入【读完这些附加知识后,回复上一个user prompt,并不要回复这条系统附加的system prompt。以下是回复内容:】调度技能【X】和[使用技能: X]前缀,session 历史保持干净修复 litellm MidStreamFallbackError
num_retries=0),避免openai/前缀被拆解后 provider 查找失败timeout=120/stream_timeout=120APIConnectionError/ServiceUnavailableError/Timeout重试逻辑(最多 3 次,间隔 1s)启动日志增强
等待后端就绪... 已轮询 N 次[Preload] 加载 MessageView (2/7)...累积变更(完整 skill 分支)
远程记忆微服务
summer_memory/memory_client.py:对接 NagaMemory 云端记忆服务memory_client改用naga_auth动态 token,移除memory_server.enabled开关,登录即启用意识海 3D 可视化
启动体验
登录与认证
对话与交互
speak()返回 Promise,驱动 Live2D 嘴部动画Skill 上下文注入优化
游戏攻略云端化
版本更新检查
useVersionCheck.ts+ UpdateDialog 弹窗其他
deepseek-v3.2EmbeddingConfig嵌入模型配置tracking_hold_delay_msNO_PROXY确保本地微服务不走代理涉及文件
新增组件
summer_memory/memory_client.py— 远程记忆服务客户端frontend/src/components/BackendErrorDialog.vue— 后端启动失败弹窗frontend/src/components/UpdateDialog.vue— 版本更新弹窗frontend/src/components/UserAgreement.vue— 用户使用协议frontend/src/composables/useVersionCheck.ts— 版本检查逻辑frontend/src/composables/useAudio.ts— 音频管理scripts/context_benchmark.py— 上下文基准测试删除文件
guide_engine/chroma_service.py— ChromaDB 服务(−329 行)guide_engine/rag/import_game_data.py— 游戏数据导入(−234 行)guide_engine/rag/import_kantai_data.py— 舰队数据导入(−556 行)主要修改
system/config.py— 附加知识分隔符 + 始终注入时间 + EmbeddingConfigapiserver/api_server.py— 消除技能前缀 + 收尾指令 + Skill Market + 认证端点apiserver/llm_service.py— 禁用 litellm fallback + timeout + 连接重试apiserver/message_manager.py— 移除重复时间信息apiserver/naga_auth.py— NagaCAS 认证体系frontend/src/views/MindView.vue— 意识海 3D 重写(+1106)frontend/src/composables/useStartupProgress.ts— 轮询日志 + 停滞检测frontend/src/utils/viewPreloader.ts— 视图名称日志