Version: 0.9.80.dev.260506
后端: 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。
This commit is contained in:
@@ -118,6 +118,19 @@ function Get-InfrastructureComposeServices {
|
||||
)
|
||||
}
|
||||
|
||||
function Get-KafkaTopicDefinitions {
|
||||
return @(
|
||||
"smartflow.agent.outbox",
|
||||
"smartflow.task.outbox",
|
||||
"smartflow.memory.outbox",
|
||||
"smartflow.active-scheduler.outbox",
|
||||
"smartflow.notification.outbox",
|
||||
"smartflow.taskclass-forum.outbox",
|
||||
"smartflow.llm.outbox",
|
||||
"smartflow.token-store.outbox"
|
||||
)
|
||||
}
|
||||
|
||||
function Get-BackendServiceDefinitions {
|
||||
return @(
|
||||
[pscustomobject]@{
|
||||
@@ -160,6 +173,16 @@ function Get-BackendServiceDefinitions {
|
||||
StartTimeoutSec = 90
|
||||
Dependencies = @()
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Name = "llm"
|
||||
Package = "./cmd/llm"
|
||||
BinaryPath = (Join-Path $BinRoot "llm.exe")
|
||||
Port = 9096
|
||||
ProbeType = "tcp"
|
||||
ProbeTarget = $null
|
||||
StartTimeoutSec = 120
|
||||
Dependencies = @()
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Name = "course"
|
||||
Package = "./cmd/course"
|
||||
@@ -168,7 +191,7 @@ function Get-BackendServiceDefinitions {
|
||||
ProbeType = "tcp"
|
||||
ProbeTarget = $null
|
||||
StartTimeoutSec = 120
|
||||
Dependencies = @()
|
||||
Dependencies = @("llm")
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Name = "tokenstore"
|
||||
@@ -198,10 +221,11 @@ function Get-BackendServiceDefinitions {
|
||||
ProbeType = "tcp"
|
||||
ProbeTarget = $null
|
||||
StartTimeoutSec = 150
|
||||
Dependencies = @()
|
||||
Dependencies = @("llm")
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Name = "taskclassforum"
|
||||
Aliases = @("forum")
|
||||
Package = "./cmd/taskclassforum"
|
||||
BinaryPath = (Join-Path $BinRoot "taskclassforum.exe")
|
||||
Port = 9090
|
||||
@@ -218,7 +242,7 @@ function Get-BackendServiceDefinitions {
|
||||
ProbeType = "tcp"
|
||||
ProbeTarget = $null
|
||||
StartTimeoutSec = 120
|
||||
Dependencies = @("task", "schedule")
|
||||
Dependencies = @("task", "schedule", "llm")
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Name = "agent"
|
||||
@@ -228,7 +252,7 @@ function Get-BackendServiceDefinitions {
|
||||
ProbeType = "tcp"
|
||||
ProbeTarget = $null
|
||||
StartTimeoutSec = 180
|
||||
Dependencies = @("task", "schedule", "task-class", "memory")
|
||||
Dependencies = @("task", "schedule", "task-class", "memory", "llm")
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Name = "api"
|
||||
@@ -244,6 +268,7 @@ function Get-BackendServiceDefinitions {
|
||||
"schedule",
|
||||
"task-class",
|
||||
"course",
|
||||
"llm",
|
||||
"tokenstore",
|
||||
"notification",
|
||||
"memory",
|
||||
@@ -261,13 +286,33 @@ function Get-BackendServiceDefinition {
|
||||
[string]$Name
|
||||
)
|
||||
|
||||
foreach ($service in (Get-BackendServiceDefinitions)) {
|
||||
if ($service.Name -eq $Name) {
|
||||
$serviceDefinitions = @(Get-BackendServiceDefinitions)
|
||||
foreach ($service in $serviceDefinitions) {
|
||||
$aliases = @()
|
||||
if ($service.PSObject.Properties.Name -contains "Aliases" -and $null -ne $service.Aliases) {
|
||||
$aliases = @($service.Aliases)
|
||||
}
|
||||
|
||||
if ($service.Name -eq $Name -or $aliases -contains $Name) {
|
||||
return $service
|
||||
}
|
||||
}
|
||||
|
||||
throw "Service definition not found: $Name"
|
||||
$availableNames = foreach ($service in $serviceDefinitions) {
|
||||
$aliases = @()
|
||||
if ($service.PSObject.Properties.Name -contains "Aliases" -and $null -ne $service.Aliases) {
|
||||
$aliases = @($service.Aliases)
|
||||
}
|
||||
|
||||
if ($aliases.Count -gt 0) {
|
||||
"{0} ({1})" -f $service.Name, ($aliases -join ", ")
|
||||
}
|
||||
else {
|
||||
$service.Name
|
||||
}
|
||||
}
|
||||
|
||||
throw "Service definition not found: $Name. Available names: $($availableNames -join '; ')"
|
||||
}
|
||||
|
||||
function Get-ServicePidFilePath {
|
||||
@@ -859,6 +904,31 @@ function Start-BackendInfrastructure {
|
||||
foreach ($definition in (Get-InfrastructureDefinitions)) {
|
||||
Wait-ContainerStatus -ContainerDefinition $definition
|
||||
}
|
||||
|
||||
Ensure-KafkaTopics
|
||||
}
|
||||
|
||||
function Ensure-KafkaTopics {
|
||||
Assert-ToolExists -Name "docker"
|
||||
|
||||
foreach ($topic in (Get-KafkaTopicDefinitions)) {
|
||||
$arguments = @(
|
||||
"exec",
|
||||
"smartflow-kafka",
|
||||
"/opt/kafka/bin/kafka-topics.sh",
|
||||
"--bootstrap-server",
|
||||
"localhost:9092",
|
||||
"--create",
|
||||
"--if-not-exists",
|
||||
"--topic",
|
||||
$topic,
|
||||
"--partitions",
|
||||
"3",
|
||||
"--replication-factor",
|
||||
"1"
|
||||
)
|
||||
Invoke-ExternalCommand -FilePath "docker" -Arguments $arguments -WorkingDirectory $RepoRoot
|
||||
}
|
||||
}
|
||||
|
||||
function Stop-BackendInfrastructure {
|
||||
|
||||
Reference in New Issue
Block a user