后端: 1. LLM 独立服务与统一计费出口落地:新增 `cmd/llm`、`client/llm` 与 `services/llm/rpc`,补齐 BillingContext、CreditBalanceGuard、价格规则解析、stream usage 归集与 `credit.charge.requested` outbox 发布,active-scheduler / agent / course / memory / gateway fallback 全部改走 llm zrpc,不再各自本地初始化模型。 2. TokenStore 收口为 Credit 权威账本:新增 credit account / ledger / product / order / price-rule / reward-rule 能力与 Redis 快照缓存,扩展 tokenstore rpc/client 支撑余额快照、消耗看板、商品、订单、流水、价格规则和奖励规则,并接入 LLM charge 事件消费完成 Credit 扣费落账。 3. 计费旧链路下线与网关切口切换:`/token-store` 语义整体切到 `/credit-store`,agent chat 移除旧 TokenQuotaGuard,userauth 的 CheckTokenQuota / AdjustTokenUsage 改为废弃,聊天历史落库不再同步旧 token 额度账本,course 图片解析请求补 user_id 进入新计费口径。 前端: 4. 计划广场从 mock 数据切到真实接口:新增 forum api/types,首页支持真实列表、标签、搜索、防抖、点赞、导入和发布计划,详情页补齐帖子详情、评论树、回复和删除评论链路,同时补上“至少一个标签”的前后端约束与默认标签兜底。 5. 商店页切到 Credit 体系并重做展示:顶部改为余额 + Credit/Token 消耗看板,支持 24h/7d/30d/all 周期切换;套餐区展示原价与当前价;历史区改为当前用户 Credit 流水并支持查看更多,整体视觉和交互同步收口。 仓库: 6. 配置与本地启动体系补齐 llm / outbox 编排:`config.example.yaml` 增加 llm rpc 和统一 outbox service 配置,`dev-common.ps1` 把 llm 纳入多服务依赖并自动建 Kafka topic,`docker-compose.yml` 同步初始化 agent/task/memory/active-scheduler/notification/taskclass-forum/llm/token-store 全量 outbox topic。
271 lines
5.7 KiB
YAML
271 lines
5.7 KiB
YAML
# SmartFlow 后端配置示例
|
|
#
|
|
# 说明:
|
|
# 1. 请复制为 config.yaml 后按实际环境填写。
|
|
# 2. 本示例只保留当前代码仍会读取的配置项,避免示例与运行配置持续漂移。
|
|
|
|
# 服务启动配置。
|
|
server:
|
|
port: 8080
|
|
|
|
# MySQL 主库配置。
|
|
database:
|
|
host: localhost
|
|
port: 3306
|
|
user: smartflow_user
|
|
password: "put_your_database_password_here"
|
|
dbname: "put_your_database_name_here"
|
|
|
|
# 登录态与鉴权令牌配置。
|
|
jwt:
|
|
accessSecret: "put_your_jwt_access_secret_here"
|
|
refreshSecret: "put_your_jwt_refresh_secret_here"
|
|
accessTokenExpire: 15min
|
|
refreshTokenExpire: 7d
|
|
|
|
# Redis 配置。
|
|
redis:
|
|
host: localhost
|
|
port: 6379
|
|
password: ""
|
|
|
|
# user/auth zrpc 独立服务与网关客户端配置。
|
|
userauth:
|
|
rpc:
|
|
listenOn: "0.0.0.0:9081"
|
|
endpoints:
|
|
- "127.0.0.1:9081"
|
|
timeout: 2s
|
|
|
|
# 计划广场 zrpc 独立服务与网关客户端配置。
|
|
taskclassforum:
|
|
rpc:
|
|
listenOn: "0.0.0.0:9090"
|
|
endpoints:
|
|
- "127.0.0.1:9090"
|
|
timeout: 2s
|
|
|
|
# Token 商店 zrpc 独立服务与网关客户端配置。
|
|
tokenstore:
|
|
reward:
|
|
forumLikeAmount: 1
|
|
forumImportAmount: 5
|
|
rpc:
|
|
listenOn: "0.0.0.0:9095"
|
|
endpoints:
|
|
- "127.0.0.1:9095"
|
|
timeout: 2s
|
|
|
|
# LLM zrpc 独立服务与各业务服务客户端配置。
|
|
llm:
|
|
rpc:
|
|
listenOn: "0.0.0.0:9096"
|
|
endpoints:
|
|
- "127.0.0.1:9096"
|
|
timeout: 0s
|
|
|
|
# Kafka outbox 事件总线配置。
|
|
kafka:
|
|
enabled: true
|
|
brokers:
|
|
- "localhost:9092"
|
|
topic: "smartflow.agent.outbox"
|
|
groupID: "smartflow-agent-outbox-consumer"
|
|
retryScanInterval: 1s
|
|
retryBatchSize: 100
|
|
maxRetry: 20
|
|
|
|
outbox:
|
|
services:
|
|
agent:
|
|
topic: "smartflow.agent.outbox"
|
|
groupID: "smartflow-agent-outbox-consumer"
|
|
table: "agent_outbox_messages"
|
|
task:
|
|
topic: "smartflow.task.outbox"
|
|
groupID: "smartflow-task-outbox-consumer"
|
|
table: "task_outbox_messages"
|
|
memory:
|
|
topic: "smartflow.memory.outbox"
|
|
groupID: "smartflow-memory-outbox-consumer"
|
|
table: "memory_outbox_messages"
|
|
active-scheduler:
|
|
topic: "smartflow.active-scheduler.outbox"
|
|
groupID: "smartflow-active-scheduler-outbox-consumer"
|
|
table: "active_scheduler_outbox_messages"
|
|
notification:
|
|
topic: "smartflow.notification.outbox"
|
|
groupID: "smartflow-notification-outbox-consumer"
|
|
table: "notification_outbox_messages"
|
|
taskclass-forum:
|
|
topic: "smartflow.taskclass-forum.outbox"
|
|
groupID: "smartflow-taskclass-forum-outbox-consumer"
|
|
table: "taskclass_forum_outbox_messages"
|
|
llm:
|
|
topic: "smartflow.llm.outbox"
|
|
groupID: "smartflow-llm-outbox-consumer"
|
|
table: "llm_outbox_messages"
|
|
token-store:
|
|
topic: "smartflow.token-store.outbox"
|
|
groupID: "smartflow-token-store-outbox-consumer"
|
|
table: "token_store_outbox_messages"
|
|
|
|
# 通知投递配置。
|
|
notification:
|
|
rpc:
|
|
listenOn: "0.0.0.0:9082"
|
|
endpoints:
|
|
- "127.0.0.1:9082"
|
|
timeout: 6s
|
|
frontendBaseURL: "http://localhost:5173"
|
|
retryScanEvery: 1m
|
|
retryBatchSize: 50
|
|
|
|
# 日程服务配置。
|
|
schedule:
|
|
rpc:
|
|
listenOn: "0.0.0.0:9084"
|
|
endpoints:
|
|
- "127.0.0.1:9084"
|
|
timeout: 6s
|
|
|
|
# 任务服务配置。
|
|
task:
|
|
rpc:
|
|
listenOn: "0.0.0.0:9085"
|
|
endpoints:
|
|
- "127.0.0.1:9085"
|
|
timeout: 6s
|
|
|
|
# 任务类服务配置。
|
|
taskClass:
|
|
rpc:
|
|
listenOn: "0.0.0.0:9086"
|
|
endpoints:
|
|
- "127.0.0.1:9086"
|
|
timeout: 6s
|
|
|
|
# 课程服务配置。
|
|
course:
|
|
rpc:
|
|
listenOn: "0.0.0.0:9087"
|
|
endpoints:
|
|
- "127.0.0.1:9087"
|
|
timeout: 5m
|
|
|
|
# 主动调度服务配置。
|
|
activeScheduler:
|
|
rpc:
|
|
listenOn: "0.0.0.0:9083"
|
|
endpoints:
|
|
- "127.0.0.1:9083"
|
|
timeout: 8s
|
|
jobScanEvery: 1m
|
|
jobScanLimit: 50
|
|
|
|
# 时间与学期边界配置。
|
|
time:
|
|
zone: "Asia/Shanghai"
|
|
semesterStartDate: "2026-03-02"
|
|
semesterEndDate: "2026-07-19"
|
|
|
|
# 智能体模型配置。
|
|
agent:
|
|
rpc:
|
|
listenOn: "0.0.0.0:9089"
|
|
endpoints:
|
|
- "127.0.0.1:9089"
|
|
timeout: 0s
|
|
chat:
|
|
enabled: true
|
|
api:
|
|
enabled: true
|
|
liteModel: "doubao-seed-2-0-code-preview-260215"
|
|
proModel: "doubao-seed-2-0-code-preview-260215"
|
|
maxModel: "doubao-seed-2-0-code-preview-260215"
|
|
baseURL: "https://ark.cn-beijing.volces.com/api/v3"
|
|
thinking:
|
|
plan: true
|
|
execute: true
|
|
deliver: false
|
|
memory: false
|
|
|
|
# 课表图片导入识别配置。
|
|
courseImport:
|
|
visionModel: ""
|
|
maxImageBytes: 5242880
|
|
maxTokens: 8192
|
|
|
|
# 通用 RAG 配置。
|
|
rag:
|
|
enabled: true
|
|
store: "milvus"
|
|
topK: 8
|
|
threshold: 0.55
|
|
retrieve:
|
|
timeoutMs: 1500
|
|
ingest:
|
|
chunkSize: 400
|
|
chunkOverlap: 80
|
|
embed:
|
|
provider: "eino"
|
|
model: "doubao-embedding-vision-251215"
|
|
baseURL: "https://ark.cn-beijing.volces.com/api/v3"
|
|
timeoutMs: 1200
|
|
dimension: 1024
|
|
reranker:
|
|
enabled: false
|
|
provider: "noop"
|
|
timeoutMs: 1200
|
|
milvus:
|
|
address: "http://localhost:19530"
|
|
token: "root:Milvus"
|
|
dbName: ""
|
|
collectionName: "smartflow_rag_chunks"
|
|
metricType: "COSINE"
|
|
requestTimeoutMs: 1500
|
|
|
|
# 记忆模块配置。
|
|
memory:
|
|
rpc:
|
|
listenOn: "0.0.0.0:9088"
|
|
endpoints:
|
|
- "127.0.0.1:9088"
|
|
timeout: 6s
|
|
enabled: true
|
|
rag:
|
|
enabled: true
|
|
read:
|
|
mode: legacy
|
|
constraintLimit: 5
|
|
preferenceLimit: 5
|
|
factLimit: 5
|
|
inject:
|
|
renderMode: flat
|
|
prompt:
|
|
extract: ""
|
|
decision: ""
|
|
threshold: 0.55
|
|
enableReranker: false
|
|
llm:
|
|
temperature: 0.1
|
|
topP: 0.2
|
|
job:
|
|
maxRetry: 6
|
|
worker:
|
|
pollEvery: 2s
|
|
claimBatch: 1
|
|
decision:
|
|
enabled: true
|
|
candidateTopK: 5
|
|
candidateMinScore: 0.6
|
|
fallbackMode: legacy_add
|
|
write:
|
|
mode: legacy
|
|
minConfidence: 0.5
|
|
|
|
# 联网搜索能力配置。
|
|
websearch:
|
|
provider: bocha
|
|
apiKey: ""
|