本地优先的中文决策引擎。
Local-first Chinese decision engine.
Qdecision 不做泛 AI 聊天工具。它做的是另一件事:把一句模糊纠结压缩成可执行判断。
Qdecision is not a generic AI chat app. It compresses one messy question into an actionable judgment.
- 一句当前倾向 / A clear current tilt
- 一个今天就能做的动作 / A first move you can take today
- 三条真正有差异的未来路径 / Three genuinely differentiated future paths
大多数“AI 决策”产品最后都会滑向两个问题:
Most AI decision products tend to collapse into two problems:
- 变成陪聊,输出很多话,但不真正收束判断
They become chatty companions that generate many words without converging on a real judgment. - 变成长问卷,输入成本很高,用户在开始前就流失
They become long questionnaires with high input cost and user drop-off before the real value starts.
Qdecision 的目标正好相反:
Qdecision is designed in the opposite direction:
- 先降低输入负担 / Lower the input burden first
- 只追问会改变结果的变量 / Ask only the variables that can change the answer
- 先给判断,再给解释 / Deliver judgment first, explanation second
- 默认支持本地运行 / Default to local execution instead of remote-first infrastructure
| Dimension / 维度 | Typical AI Chat / 普通 AI Chat | Qdecision |
|---|---|---|
| Input / 输入方式 | Open-ended conversation / 一直开放对话 | One raw question, then 2 to 4 key follow-ups / 先一句问题,再进入 2 到 4 个关键追问 |
| Output goal / 输出目标 | Keep talking / 尽量“聊得多” | Make the judgment clearer / 尽量“判断得清楚” |
| Result structure / 结果结构 | Generic advice block / 一段泛化建议 | Judgment, action, boundary, future paths / 判断、行动、边界、未来路径 |
| Interaction rhythm / 交互节奏 | Single open loop / 一直开放式 | Quick first, full second / 先 quick,再 full |
| Local runability / 本地可运行性 | Often secondary / 常常不是重点 | Ollama + SQLite by default / 默认 Ollama + SQLite 可跑 |
当前仓库已经具备完整主链路:
The repository already includes the full product loop:
- 首页输入 / Home input
- 启动过渡页 / Start transition
- 关键追问 / Clarifying questions
quick/full双阶段生成 / Two-stagequickandfullgeneration- 单列结果页 / Single-column result narrative
- 历史记录与反馈 / History and feedback
- 匿名 owner 隔离 / Anonymous owner isolation
- Vitest + Playwright 验证 / Vitest + Playwright coverage
当前仓库质量门槛:
Current quality gates:
npm run checknpm run buildnpm run test:e2e
| Home / 首页 | Result / 结果页 |
|---|---|
![]() |
![]() |
flowchart LR
A[Home Input] --> B[Create Session]
B --> C[Classify]
C --> D[Generate Questions]
D --> E[Analyze]
E --> F[Quick Judgment]
F --> G[Full Report]
G --> H[Result Narrative]
H --> I[History and Feedback]
- 首页极简输入 + 示例起手 / Minimal home input plus guided starters
- 启动过渡页,先拆问题再进入追问 / Start transition that frames the problem before analysis
- 2 到 4 个关键追问,降低表达负担 / 2 to 4 key follow-ups instead of a long form
quick+full双阶段结果生成 / Two-stagequickandfullgeneration- 结果页单列裁决流 / Single-column result narrative:
- 主判断 / Main judgment
- Closing line
- 为什么这样判断 / Why this judgment
- 第一行动 / First action
- 判断边界 / Judgment boundary
- Future path tree
- Ollama / OpenAI provider 切换 / Ollama and OpenAI provider switching
- 匿名浏览器 owner 隔离 / Anonymous browser owner isolation
- 历史记录与反馈 / History and feedback
- Zod 校验 + JSON 修复 + fallback / Zod validation, JSON repair, and fallbacks
- Vitest + Playwright
如果你希望最少步骤跑起来,直接执行:
If you want the shortest path to a running app:
npm install
npm run start:local这个脚本会自动完成以下动作:
This script will automatically:
- 补
.env/ create.envif missing - 准备本地 SQLite / prepare local SQLite
prisma generateprisma db push- 如果默认 provider 是 Ollama,则检查服务和模型 / check Ollama service and models when Ollama is the default provider
- 启动开发服务器 / start the development server
npm install
cp .env.example .envOption A: Ollama
ollama list默认模型 / Default models:
glm-4.7-flash:latestqwen3.5:35b
Option B: OpenAI
在 .env 中设置:
Set the following in .env:
DEFAULT_LLM_PROVIDER=openai
OPENAI_API_KEY=your_key_here默认 OpenAI 模型 / Default OpenAI models:
gpt-5-minigpt-5.4
touch prisma/dev.db
npm run db:pushnpm run dev打开 http://127.0.0.1:3000
Open http://127.0.0.1:3000
- 用户在
/输入一句自然语言问题 / The user enters a raw decision question on/ - 服务端创建
DecisionSession/ The server creates aDecisionSession classify识别领域、紧迫度、隐藏张力、缺失信息 /classifyextracts domain, urgency, hidden tensions, and missing informationgenerateQuestions生成 2 到 4 个关键追问 /generateQuestionsproduces 2 to 4 key follow-ups- 用户在
/analyze完成回答 / The user answers on/analyze quick先给当前判断 /quickgenerates the first tiltfull再补完整报告、行动和未来路径 /fulladds the full report, action, and future paths/result/[sessionId]把它们整合成单列叙事结果页 //result/[sessionId]merges them into one narrative result page
src/app/ # 页面与 API 路由 / pages + route handlers
src/components/ # home / chat / result / history UI
src/lib/decision/ # 决策链路与 fallback / intake / pipeline / fallback / report / repository
src/lib/llm/ # provider 路由与结构化解析 / provider routing / prompts / structured parsing
src/types/ # decision / api / feedback types
prisma/ # Prisma schema + local SQLite db
docs/ # 产品、调试与架构文档 / product, debugging, and architecture docs更完整的结构说明见 docs/ARCHITECTURE.md。
See docs/ARCHITECTURE.md for a fuller architecture walkthrough.
默认采用双阶段模型策略:
The default setup uses a two-stage model strategy:
fast model用于classify / generateQuestions / quick
Used forclassify / generateQuestions / quickdeep model用于fullReport / personalize
Used forfullReport / personalize
默认 provider 组合 / Default provider presets:
- Ollama:
glm-4.7-flash:latest+qwen3.5:35b - OpenAI:
gpt-5-mini+gpt-5.4
npm run lint
npm run typecheck
npm run test
npm run build
npm run check
npm run test:e2enpm run check 会串行执行 lint + typecheck + test。
npm run check runs lint + typecheck + test in sequence.
POST /api/decision/startPOST /api/decision/answerPOST /api/decision/quickPOST /api/decision/fullPOST /api/decision/retryGET /api/decision/session/[sessionId]GET /api/decision/historyGET /api/llm/optionsPOST /api/feedbackGET /api/health
- 所有结构化输出都先走 Zod 校验 / All structured outputs are validated by Zod first
- JSON 不合法时会自动尝试一次修复 / Invalid JSON triggers one repair attempt
classify / questions / quick / full / personalize都有 fallback /classify / questions / quick / full / personalizeall have fallbackshistory / session / answer / full / retone / feedback都受qdecision_viewer_idowner 隔离 /history / session / answer / full / retone / feedbackare isolated byqdecision_viewer_id- 每个响应头都带
x-request-id/ Every response includesx-request-id
这个仓库目前已经包含:
This repository already includes:
- CONTRIBUTING.md
- SECURITY.md
- CODE_OF_CONDUCT.md
- GitHub issue templates
- PR template
- CI workflow
- 功能说明 / Functional Overview
- 产品设计说明 / Product Design Notes
- 调试与日志 / Debugging and Logs
- 架构说明 / Architecture
欢迎贡献,优先方向:
Contributions are welcome, especially in:
- 主链路体验 / core user flow quality
- 可复现性 / reproducibility
- 测试覆盖 / test coverage
- 文档清晰度 / documentation clarity
开始前先看 CONTRIBUTING.md。
Read CONTRIBUTING.md before opening a PR.

