fix: improve build/install scripts for kb_compiler support#1
Open
wislonl wants to merge 32 commits into
Open
Conversation
- RAG 多轮上下文:短消息(<30字)自动拼接上一轮查询 - RAG prompt 加强:禁止 AI 用自己的知识补充,未命中直接回复 - 知识库全文解读:hover 文件显示"全文"按钮,跳过 RAG 直接拼全文 - 侧边栏文案:项目·临时资料 / 知识库·长期资料,加副标题说明 - 项目数据迁移到 ~/.lobsterbox/projects.json - 自动滚动:新回复滚到内容顶部,思考中提示不被输入框遮挡 - 输入框去掉滚动条(overflow-y:hidden)
- install.sh 安装时在板子上编译 app.py/kb_indexer.py 为 .pyc,删除源码 - build.sh 排除 build.sh/tests/pyc 开发文件 - login.html 设置密码后跳转 /?config=1 自动打开配置页 - index.html 检测 config=1 参数自动打开配置页 - install.sh 支持本地 wheels 离线安装 Python 依赖
- 用 sudo -u + 环境变量解决 systemctl --user 在 sudo 下失败 - pip 优先本地 wheels,缺包自动回退在线安装 - openclaw 已装时也重建 symlink - install-root.sh: root 用户自动检测普通用户并以该用户身份安装
Flask 以系统服务运行时,无法直接访问用户级 systemd bus。 新增 _systemctl_user() 始终用 sudo -u + 环境变量执行, 修复 save-api-key、save-model、restart-openclaw、 健康检查、飞书集成等 8 处 systemctl --user 调用。
- README.md: 添加 root 用户安装命令和注意事项 - 说明书.md: 安装流程增加 install-root.sh 说明,pip 策略说明, _systemctl_user() 机制说明,User= 限制说明
安全加固: - 删除后门密码,密码存储从 SHA256 升级为 PBKDF2-SHA256(10万次迭代+随机盐) - /api/save-api-key 从认证白名单移除,改用一次性临时 token 验证(扫码流程) - OpenClaw Gateway 从 --bind lan 改为 --bind local(仅监听 127.0.0.1) - 前端所有动态输出添加 _esc() HTML 转义,防止 XSS 注入 - API Key 不再明文返回,仅显示末尾4位 - 修复全部 except: 为具体异常类型 - 登录限速:同一 IP 5次失败后锁定5分钟 多用户系统: - 支持 admin/user 两种角色,管理员可创建/删除用户 - 新增 API:/api/users GET/POST、/api/users/<username> DELETE、/api/current-user - 新增 localhost 密码重置:/api/reset-password(仅本机访问) - localhost 免登录用户正确识别为 admin 角色 - 聊天 session_key 服务端强制加用户名前缀,隔离不同用户对话 前端 UI: - 侧边栏底部显示当前用户名+角色+登出按钮 - 设置页新增用户管理面板(管理员可见):用户列表、添加/删除用户 - 设置页新增修改密码表单(localhost 免登录用户自动隐藏) - 登录页支持首次创建管理员账号、忘记密码重置 飞书桥接安全修复: - 新增 Webhook token 验证、请求体大小限制、图片下载限制 - 健康检查不再暴露 APP_ID,新增优雅关闭
- deploy.sh / deploy.command: scp 上传 + 重启 lobsterbox.service - scripts/generate_tpv_meeting_ppt.py: TPV 会议 PPT 生成工具 - .gitignore: 排除 .bak、wheels/、*.zip、.claude/、.vscode/、生成文件
Replace full-screen overlay with 300px fixed right drawer using CSS transform (translateX 100%→0) + .drawer-open class toggle.
- Config panel changes from fixed overlay to inline right panel (420px), chat area shrinks when config is open instead of being covered - Config content switches to single-column compact layout in chat mode - Replace all browser prompt()/confirm() with custom styled dialogs positioned near the triggering button (11 call sites) - User avatar: replace line-art person icon with colored initial circle - Chat messages padding: use balanced centering formula (50% - 380px) - Answer body max-width increased from 720px to 900px
- Remove TROUBLESHOOTING.md, deploy.command, deploy.sh, generate_tpv_meeting_ppt.py - Update build.sh exclude list and install.sh - Add design spec and implementation plan docs - Update test files
Compare EIC-Claw77 box vs PC+OpenClaw, document LobsterBox's product value over OpenClaw's native panel, define target customers.
- Add kb_compiler.py: uploads trigger async LLM compilation into structured notes (summary, key concepts, bullet points, potential questions) stored in knowledge/compiled/ - Compiled notes indexed alongside original chunks in BM25, with compiled_ prefix for file IDs - RAG search includes both original and compiled results, with score-based filtering (skip injection when top score < 1.0) - Frontend shows source type tags before AI response: purple "📋 LLM笔记" for compiled notes, blue "📄 原文" for BM25 hits - SSE stream sends rag_sources metadata as first event - Supports both openai-completions and anthropic-messages API protocols - Handles MiniMax thinking+text response format in content array
- Chat errors now use structured error codes with actionable links (openclaw_down/restarting/no_config/no_token, bad_apikey, rate_limit, bad_model, model_error, agent_error, empty_response, flask_internal) - Distinguish restarting vs crashed by checking systemctl is-active state - Add /api/repair-openclaw-config for lightweight config fix (no reinstall) - Relax API Key validation: allow / + : etc (Baidu bce-v3/... format) - QR scan: pass provider to QR generation; auto-save on phone submit; masked ****xxxx value silently treated as already-saved - Fix chat input jumping to welcome position on page refresh - Add /api/instance-id to clear stale chat history after board reinstall - install.sh: --bind local → --bind loopback (renamed in openclaw 2026.3.28) - Fix </think> trailing artifact with 3-step regex chain
- 路由偏好支持本地模型输入框(ollama-mac/gemma4:e4b 格式)及"应用"按钮 - 切换路由模式后自动重启 openclaw-gateway,使配置立即生效 - upsert_provider 自动将 models 字符串数组转为对象数组(修复 openclaw 崩溃) - API Key 改为可选,本地模型(Ollama)留空时自动填 "ollama" - /api/config 返回 local_model 字段,页面刷新后恢复本地模型设置
- build.sh: 排除 .git/docs/deploy.sh/.superpowers 等开发文件 - install.sh: 安装前先 apt --fix-broken install 修 ESWIN SDK 依赖冲突 - install.sh: 编译步骤支持 kb_compiler.py,优先从 .py 编译确保版本匹配
wislonl
added a commit
that referenced
this pull request
Apr 17, 2026
用户需求:本地模型回答更准,但响应只小幅增加。 #1 采样参数精调(零延迟): - temperature 0.5 → 0.3(减少随机发散) - top_p 0.9 → 0.85(收紧候选) - 新增 min_p = 0.05(llama.cpp 支持,过滤低概率 token) #2 动态 system prompt(+0.3-0.6s prefill): - 新增 _classify_task() 把用户消息分到 creative/reasoning/list/qa/simple/unknown - _TASK_SYSTEM_PROMPTS 按类型注入针对性引导 (创作:"字数贴近要求";推理:"分步骤";列表:"编号规整";问答:"不废话") #3 Few-shot priming(+0.5-1s prefill,仅复杂任务): - _FEW_SHOT 每个类型一对高质量问答示范(创作/推理/列表/问答) - 样本简短(<80 tok),风格中文简洁符合"小龙虾助手"人设 - 简单问答(simple)不注入,保持零延迟 #4 think-final 分离(+10-15%,仅 creative/reasoning): - _THINK_ENABLED_TASKS = (creative, reasoning) - 用户消息末尾加 _THINK_SUFFIX 让模型先 <think> 思考再回答 - 前端已有 strip <think> 标签的渲染代码,用户看不到思考部分 chat.py 顺带改动(路由层): - _LONG_OUTPUT_KEYWORDS 加创作类词(写诗/写一首/写邮件等) - _detect_long_output_intent 加 regex (写|作|创作).{0,10}\d+\s*字 → "写 100 字的诗" 等创作+字数组合走云 - _decide_route session_upgraded 加 trivial 判定:升级后简单问题(≤50 字、 无附件、无长输出意图、无图片)仍走本地,不烧云端 token 期待效果(按场景): | 场景 | 延迟 | 质量 | |----------------------|----------|-----| | 1+1=几(simple) | +0 | +5% | | 什么是 React(qa) | +0.3s | +10-15% | | 写春天的诗(creative)| +1-1.5s | +25-30% | | 为什么 X(reasoning) | +15% | +15-20% | 测试:479 passed 21 skipped(新增 9 case:创作关键词 + 创作+字数组合 + session_upgraded trivial 豁免场景)
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.
Changes
build.sh
kb_compiler.pyin the distribution.pysource files instead of pre-compiled.pycto avoid cross-version incompatibility.superpowers/,deploy.sh, anddocs/install.sh
.pyand pre-compiled.pycfiles.pyexists to ensure version compatibilitykb_compiler.pyto compilation process.pycfiles are already present