Version: 0.9.81.dev.260506
后端: 1. Credit 价格规则补齐利润率与实际计费单价语义:新增 `profit_rate_bps` 与 `charge_*_price_micros` 展示字段,下沉共享价格推导 helper,tokenstore rpc/client/proto/model/default rule 全链路同步,LLM usage 扣费统一改按加价后的 charge 单价换算。 2. task-class 更新链路修正全量覆盖与归属校验:`runtime/conv` 保留 item id,DAO 更新前显式校验 task-class 与 item 归属,改用显式字段 map 落库 nil/空切片/零值,避免 `RowsAffected=0` 误判越权,同时补齐任务项可编辑字段更新。 3. GormCache task-class 失效补空 user_id 保护:更新语句缺少模型上下文时直接跳过失效,避免缓存插件因空指针影响主事务。 前端: 4. 课表中心补齐任务类编辑能力:新增 `updateTaskClass` API,创建弹窗支持编辑态回填与 item id 提交,日程页支持先拉详情再编辑并在保存后刷新任务类详情与列表。 5. 计划广场详情补点赞交互与奖励提示:详情页新增点赞/取消点赞按钮、奖励反馈文案与计数展示,论坛类型补 `reward_hint`,评论区与帖子作者头像统一接入兜底头像工具。 6. 品牌与展示细节收口:侧边栏与 favicon 切到项目 logo,首页标题改为 `SmartMate`,主面板缩放上限微调,论坛列表头像显示与整体品牌观感同步统一。
This commit is contained in:
@@ -18,6 +18,7 @@ type CreditPriceRule struct {
|
||||
CachedPriceMicros int64 `gorm:"column:cached_price_micros"`
|
||||
ReasoningPriceMicros int64 `gorm:"column:reasoning_price_micros"`
|
||||
CreditPerYuan int64 `gorm:"column:credit_per_yuan"`
|
||||
ProfitRateBps int64 `gorm:"column:profit_rate_bps"`
|
||||
Status string `gorm:"column:status"`
|
||||
Priority int `gorm:"column:priority"`
|
||||
Description string `gorm:"column:description"`
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
llmdao "github.com/LoveLosita/smartflow/backend/services/llm/dao"
|
||||
creditcontracts "github.com/LoveLosita/smartflow/backend/shared/contracts/creditstore"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -152,19 +153,18 @@ func quoteUsagePrice(rule llmdao.CreditPriceRule, input UsagePricingInput) Usage
|
||||
nonCachedInputTokens := inputTokens - cachedTokens
|
||||
nonReasoningOutputTokens := outputTokens - reasoningTokens
|
||||
|
||||
cachedPriceMicros := rule.CachedPriceMicros
|
||||
if cachedPriceMicros <= 0 {
|
||||
cachedPriceMicros = rule.InputPriceMicros
|
||||
}
|
||||
reasoningPriceMicros := rule.ReasoningPriceMicros
|
||||
if reasoningPriceMicros <= 0 {
|
||||
reasoningPriceMicros = rule.OutputPriceMicros
|
||||
}
|
||||
chargePrices := creditcontracts.DeriveChargePriceMicrosSet(
|
||||
rule.InputPriceMicros,
|
||||
rule.OutputPriceMicros,
|
||||
rule.CachedPriceMicros,
|
||||
rule.ReasoningPriceMicros,
|
||||
rule.ProfitRateBps,
|
||||
)
|
||||
|
||||
totalMicrosScaled := nonCachedInputTokens*maxInt64(rule.InputPriceMicros, 0) +
|
||||
cachedTokens*maxInt64(cachedPriceMicros, 0) +
|
||||
nonReasoningOutputTokens*maxInt64(rule.OutputPriceMicros, 0) +
|
||||
reasoningTokens*maxInt64(reasoningPriceMicros, 0)
|
||||
totalMicrosScaled := nonCachedInputTokens*maxInt64(chargePrices.InputChargePriceMicros, 0) +
|
||||
cachedTokens*maxInt64(chargePrices.CachedChargePriceMicros, 0) +
|
||||
nonReasoningOutputTokens*maxInt64(chargePrices.OutputChargePriceMicros, 0) +
|
||||
reasoningTokens*maxInt64(chargePrices.ReasoningChargePriceMicros, 0)
|
||||
|
||||
rmbCostMicros := ceilDivInt64(totalMicrosScaled, tokenPriceScalePer1K)
|
||||
creditCost := int64(0)
|
||||
|
||||
Reference in New Issue
Block a user