finance-tools/AI_SETUP.md

42 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 問 AI 設定指南
## 1. 填入 API Key
側邊欄 **設定**,或開啟 `app/.env`
```env
# 擇一或兩者都填,並選預設 provider
GROK_API_KEY=xai-...
GROK_MODEL=grok-3-mini
OPENCODE_GO_API_KEY=...
OPENCODE_GO_MODEL=...
AI_ACTIVE_PROVIDER=grok
# 總經資料(非 AI但基地/市場需要)
FRED_API_KEY=...
```
儲存後後端立即生效;改 `PORT` 需重啟 `node server.js`
## 2. 使用方式
- 右下角 **金幣貓頭鷹**:全站浮動問答
- 卡片右上角 **問 AI**:自動附上該卡片的頁面 context
- **技能快捷**:依頁面預設提問(可擴充為 skill / MCP
## 3. Provider 架構
| Provider | 端點 | 環境變數 |
|----------|------|----------|
| Grok (xAI) | `api.x.ai/v1/responses` | `GROK_API_KEY`, `GROK_MODEL` |
| OpenCode Go | `opencode.ai/zen/go/v1/chat/completions` | `OPENCODE_GO_API_KEY`, `OPENCODE_GO_MODEL` |
後端代理:`POST /api/ai/chat`、`POST /api/ai/context`、`GET /api/ai/status`
## 4. Context 附帶內容
| 頁面 | view | 資料 |
|------|------|------|
| 基地 | `hub` | 總經分數、訊號、羅盤 |
| 市場世界 | `market` | 同上 + 分頁(板塊/日曆)|