mirror of
https://github.com/woodchen-ink/aimodels-prices.git
synced 2025-07-18 13:41:59 +08:00
优化价格计算逻辑,新增扩展价格字段的相对基准映射,重构前端展示逻辑,提升用户体验和代码可维护性。
This commit is contained in:
parent
eedee45861
commit
85ef87df11
@ -35,6 +35,20 @@ type PriceRate struct {
|
|||||||
ExtraRatios *ExtraRatios `json:"extra_ratios,omitempty"`
|
ExtraRatios *ExtraRatios `json:"extra_ratios,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 定义扩展价格字段是否相对于input的映射
|
||||||
|
var extraRelativeToInput = map[string]bool{
|
||||||
|
"cached_tokens": true,
|
||||||
|
"cached_write_tokens": true,
|
||||||
|
"cached_read_tokens": true,
|
||||||
|
"input_audio_tokens": true,
|
||||||
|
"output_audio_tokens": false,
|
||||||
|
"reasoning_tokens": false,
|
||||||
|
"input_text_tokens": true,
|
||||||
|
"output_text_tokens": false,
|
||||||
|
"input_image_tokens": true,
|
||||||
|
"output_image_tokens": false,
|
||||||
|
}
|
||||||
|
|
||||||
// GetPriceRates 获取价格倍率
|
// GetPriceRates 获取价格倍率
|
||||||
func GetPriceRates(c *gin.Context) {
|
func GetPriceRates(c *gin.Context) {
|
||||||
cacheKey := "one_hub_price_rates"
|
cacheKey := "one_hub_price_rates"
|
||||||
@ -87,103 +101,173 @@ func GetPriceRates(c *gin.Context) {
|
|||||||
|
|
||||||
// 计算各扩展价格字段的倍率
|
// 计算各扩展价格字段的倍率
|
||||||
if price.InputAudioTokens != nil {
|
if price.InputAudioTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["input_audio_tokens"] {
|
||||||
rate = round(*price.InputAudioTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.InputAudioTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.InputAudioTokens/2, 4) / baseRate
|
||||||
extraRatios.InputAudioTokens = &rate
|
extraRatios.InputAudioTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.InputAudioTokens/14, 4) / baseRate
|
||||||
|
extraRatios.InputAudioTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.OutputAudioTokens != nil {
|
if price.OutputAudioTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["output_audio_tokens"] {
|
||||||
rate = round(*price.OutputAudioTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.OutputAudioTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.OutputAudioTokens/2, 4) / baseRate
|
||||||
extraRatios.OutputAudioTokens = &rate
|
extraRatios.OutputAudioTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.OutputAudioTokens/14, 4) / baseRate
|
||||||
|
extraRatios.OutputAudioTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.CachedTokens != nil {
|
if price.CachedTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["cached_tokens"] {
|
||||||
rate = round(*price.CachedTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.CachedTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.CachedTokens/2, 4) / baseRate
|
||||||
extraRatios.CachedTokens = &rate
|
extraRatios.CachedTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.CachedTokens/14, 4) / baseRate
|
||||||
|
extraRatios.CachedTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.CachedReadTokens != nil {
|
if price.CachedReadTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["cached_read_tokens"] {
|
||||||
rate = round(*price.CachedReadTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.CachedReadTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.CachedReadTokens/2, 4) / baseRate
|
||||||
extraRatios.CachedReadTokens = &rate
|
extraRatios.CachedReadTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.CachedReadTokens/14, 4) / baseRate
|
||||||
|
extraRatios.CachedReadTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.CachedWriteTokens != nil {
|
if price.CachedWriteTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["cached_write_tokens"] {
|
||||||
rate = round(*price.CachedWriteTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.CachedWriteTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.CachedWriteTokens/2, 4) / baseRate
|
||||||
extraRatios.CachedWriteTokens = &rate
|
extraRatios.CachedWriteTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.CachedWriteTokens/14, 4) / baseRate
|
||||||
|
extraRatios.CachedWriteTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.ReasoningTokens != nil {
|
if price.ReasoningTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["reasoning_tokens"] {
|
||||||
rate = round(*price.ReasoningTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.ReasoningTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.ReasoningTokens/2, 4) / baseRate
|
||||||
extraRatios.ReasoningTokens = &rate
|
extraRatios.ReasoningTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.ReasoningTokens/14, 4) / baseRate
|
||||||
|
extraRatios.ReasoningTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.InputTextTokens != nil {
|
if price.InputTextTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["input_text_tokens"] {
|
||||||
rate = round(*price.InputTextTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.InputTextTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.InputTextTokens/2, 4) / baseRate
|
||||||
extraRatios.InputTextTokens = &rate
|
extraRatios.InputTextTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.InputTextTokens/14, 4) / baseRate
|
||||||
|
extraRatios.InputTextTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.OutputTextTokens != nil {
|
if price.OutputTextTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["output_text_tokens"] {
|
||||||
rate = round(*price.OutputTextTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.OutputTextTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.OutputTextTokens/2, 4) / baseRate
|
||||||
extraRatios.OutputTextTokens = &rate
|
extraRatios.OutputTextTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.OutputTextTokens/14, 4) / baseRate
|
||||||
|
extraRatios.OutputTextTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.InputImageTokens != nil {
|
if price.InputImageTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["input_image_tokens"] {
|
||||||
rate = round(*price.InputImageTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.InputImageTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.InputImageTokens/2, 4) / baseRate
|
||||||
extraRatios.InputImageTokens = &rate
|
extraRatios.InputImageTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.InputImageTokens/14, 4) / baseRate
|
||||||
|
extraRatios.InputImageTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.OutputImageTokens != nil {
|
if price.OutputImageTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["output_image_tokens"] {
|
||||||
rate = round(*price.OutputImageTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.OutputImageTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.OutputImageTokens/2, 4) / baseRate
|
||||||
extraRatios.OutputImageTokens = &rate
|
extraRatios.OutputImageTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.OutputImageTokens/14, 4) / baseRate
|
||||||
|
extraRatios.OutputImageTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,103 +369,173 @@ func GetOfficialPriceRates(c *gin.Context) {
|
|||||||
|
|
||||||
// 计算各扩展价格字段的倍率
|
// 计算各扩展价格字段的倍率
|
||||||
if price.InputAudioTokens != nil {
|
if price.InputAudioTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["input_audio_tokens"] {
|
||||||
rate = round(*price.InputAudioTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.InputAudioTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.InputAudioTokens/2, 4) / baseRate
|
||||||
extraRatios.InputAudioTokens = &rate
|
extraRatios.InputAudioTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.InputAudioTokens/14, 4) / baseRate
|
||||||
|
extraRatios.InputAudioTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.OutputAudioTokens != nil {
|
if price.OutputAudioTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["output_audio_tokens"] {
|
||||||
rate = round(*price.OutputAudioTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.OutputAudioTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.OutputAudioTokens/2, 4) / baseRate
|
||||||
extraRatios.OutputAudioTokens = &rate
|
extraRatios.OutputAudioTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.OutputAudioTokens/14, 4) / baseRate
|
||||||
|
extraRatios.OutputAudioTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.CachedTokens != nil {
|
if price.CachedTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["cached_tokens"] {
|
||||||
rate = round(*price.CachedTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.CachedTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.CachedTokens/2, 4) / baseRate
|
||||||
extraRatios.CachedTokens = &rate
|
extraRatios.CachedTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.CachedTokens/14, 4) / baseRate
|
||||||
|
extraRatios.CachedTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.CachedReadTokens != nil {
|
if price.CachedReadTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["cached_read_tokens"] {
|
||||||
rate = round(*price.CachedReadTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.CachedReadTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.CachedReadTokens/2, 4) / baseRate
|
||||||
extraRatios.CachedReadTokens = &rate
|
extraRatios.CachedReadTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.CachedReadTokens/14, 4) / baseRate
|
||||||
|
extraRatios.CachedReadTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.CachedWriteTokens != nil {
|
if price.CachedWriteTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["cached_write_tokens"] {
|
||||||
rate = round(*price.CachedWriteTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.CachedWriteTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.CachedWriteTokens/2, 4) / baseRate
|
||||||
extraRatios.CachedWriteTokens = &rate
|
extraRatios.CachedWriteTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.CachedWriteTokens/14, 4) / baseRate
|
||||||
|
extraRatios.CachedWriteTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.ReasoningTokens != nil {
|
if price.ReasoningTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["reasoning_tokens"] {
|
||||||
rate = round(*price.ReasoningTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.ReasoningTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.ReasoningTokens/2, 4) / baseRate
|
||||||
extraRatios.ReasoningTokens = &rate
|
extraRatios.ReasoningTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.ReasoningTokens/14, 4) / baseRate
|
||||||
|
extraRatios.ReasoningTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.InputTextTokens != nil {
|
if price.InputTextTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["input_text_tokens"] {
|
||||||
rate = round(*price.InputTextTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.InputTextTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.InputTextTokens/2, 4) / baseRate
|
||||||
extraRatios.InputTextTokens = &rate
|
extraRatios.InputTextTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.InputTextTokens/14, 4) / baseRate
|
||||||
|
extraRatios.InputTextTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.OutputTextTokens != nil {
|
if price.OutputTextTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["output_text_tokens"] {
|
||||||
rate = round(*price.OutputTextTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.OutputTextTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.OutputTextTokens/2, 4) / baseRate
|
||||||
extraRatios.OutputTextTokens = &rate
|
extraRatios.OutputTextTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.OutputTextTokens/14, 4) / baseRate
|
||||||
|
extraRatios.OutputTextTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.InputImageTokens != nil {
|
if price.InputImageTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["input_image_tokens"] {
|
||||||
rate = round(*price.InputImageTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.InputImageTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.InputImageTokens/2, 4) / baseRate
|
||||||
extraRatios.InputImageTokens = &rate
|
extraRatios.InputImageTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.InputImageTokens/14, 4) / baseRate
|
||||||
|
extraRatios.InputImageTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if price.OutputImageTokens != nil {
|
if price.OutputImageTokens != nil {
|
||||||
var rate float64
|
var baseRate float64
|
||||||
if price.Currency == "USD" {
|
if extraRelativeToInput["output_image_tokens"] {
|
||||||
rate = round(*price.OutputImageTokens/2, 4)
|
baseRate = inputRate
|
||||||
} else {
|
} else {
|
||||||
rate = round(*price.OutputImageTokens/14, 4)
|
baseRate = outputRate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if price.Currency == "USD" {
|
||||||
|
rate := round(*price.OutputImageTokens/2, 4) / baseRate
|
||||||
extraRatios.OutputImageTokens = &rate
|
extraRatios.OutputImageTokens = &rate
|
||||||
|
} else {
|
||||||
|
rate := round(*price.OutputImageTokens/14, 4) / baseRate
|
||||||
|
extraRatios.OutputImageTokens = &rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,98 +134,80 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="extended-prices" v-if="hasAnyExtendedPrices(price)">
|
<div class="extended-prices" v-if="hasAnyExtendedPrices(price)">
|
||||||
<div class="section-title">扩展价格</div>
|
<div class="section-title">
|
||||||
|
<span>扩展价格</span>
|
||||||
|
</div>
|
||||||
<div class="extended-price-grid">
|
<div class="extended-price-grid">
|
||||||
<template v-if="hasSpecificPrice(price.input_audio_tokens)">
|
<div v-if="hasSpecificPrice(price.input_audio_tokens)" class="extended-price-item">
|
||||||
<div class="extended-price-item">
|
<span class="ext-price-label">音频输入</span>
|
||||||
<span class="ext-price-label">音频输入价格</span>
|
|
||||||
<span class="ext-price-value">{{ price.input_audio_tokens }}</span>
|
<span class="ext-price-value">{{ price.input_audio_tokens }}</span>
|
||||||
<el-tag v-if="price.temp_input_audio_tokens" type="warning" size="small" effect="light">
|
<el-tag v-if="price.temp_input_audio_tokens" type="warning" size="small" effect="light" class="temp-tag">
|
||||||
待审核: {{ price.temp_input_audio_tokens }}
|
{{ price.temp_input_audio_tokens }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div v-if="hasSpecificPrice(price.output_audio_tokens)" class="extended-price-item">
|
||||||
<template v-if="hasSpecificPrice(price.output_audio_tokens)">
|
<span class="ext-price-label">音频输出</span>
|
||||||
<div class="extended-price-item">
|
|
||||||
<span class="ext-price-label">音频输出价格</span>
|
|
||||||
<span class="ext-price-value">{{ price.output_audio_tokens }}</span>
|
<span class="ext-price-value">{{ price.output_audio_tokens }}</span>
|
||||||
<el-tag v-if="price.temp_output_audio_tokens" type="warning" size="small" effect="light">
|
<el-tag v-if="price.temp_output_audio_tokens" type="warning" size="small" effect="light" class="temp-tag">
|
||||||
待审核: {{ price.temp_output_audio_tokens }}
|
{{ price.temp_output_audio_tokens }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div v-if="hasSpecificPrice(price.cached_read_tokens)" class="extended-price-item">
|
||||||
<template v-if="hasSpecificPrice(price.cached_read_tokens)">
|
<span class="ext-price-label">缓存读取</span>
|
||||||
<div class="extended-price-item">
|
|
||||||
<span class="ext-price-label">缓存读取价格</span>
|
|
||||||
<span class="ext-price-value">{{ price.cached_read_tokens }}</span>
|
<span class="ext-price-value">{{ price.cached_read_tokens }}</span>
|
||||||
<el-tag v-if="price.temp_cached_read_tokens" type="warning" size="small" effect="light">
|
<el-tag v-if="price.temp_cached_read_tokens" type="warning" size="small" effect="light" class="temp-tag">
|
||||||
待审核: {{ price.temp_cached_read_tokens }}
|
{{ price.temp_cached_read_tokens }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div v-if="hasSpecificPrice(price.cached_write_tokens)" class="extended-price-item">
|
||||||
<template v-if="hasSpecificPrice(price.cached_write_tokens)">
|
<span class="ext-price-label">缓存写入</span>
|
||||||
<div class="extended-price-item">
|
|
||||||
<span class="ext-price-label">缓存写入价格</span>
|
|
||||||
<span class="ext-price-value">{{ price.cached_write_tokens }}</span>
|
<span class="ext-price-value">{{ price.cached_write_tokens }}</span>
|
||||||
<el-tag v-if="price.temp_cached_write_tokens" type="warning" size="small" effect="light">
|
<el-tag v-if="price.temp_cached_write_tokens" type="warning" size="small" effect="light" class="temp-tag">
|
||||||
待审核: {{ price.temp_cached_write_tokens }}
|
{{ price.temp_cached_write_tokens }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div v-if="hasSpecificPrice(price.reasoning_tokens)" class="extended-price-item">
|
||||||
<template v-if="hasSpecificPrice(price.reasoning_tokens)">
|
<span class="ext-price-label">推理</span>
|
||||||
<div class="extended-price-item">
|
|
||||||
<span class="ext-price-label">推理价格</span>
|
|
||||||
<span class="ext-price-value">{{ price.reasoning_tokens }}</span>
|
<span class="ext-price-value">{{ price.reasoning_tokens }}</span>
|
||||||
<el-tag v-if="price.temp_reasoning_tokens" type="warning" size="small" effect="light">
|
<el-tag v-if="price.temp_reasoning_tokens" type="warning" size="small" effect="light" class="temp-tag">
|
||||||
待审核: {{ price.temp_reasoning_tokens }}
|
{{ price.temp_reasoning_tokens }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div v-if="hasSpecificPrice(price.input_text_tokens)" class="extended-price-item">
|
||||||
<template v-if="hasSpecificPrice(price.input_text_tokens)">
|
<span class="ext-price-label">文本输入</span>
|
||||||
<div class="extended-price-item">
|
|
||||||
<span class="ext-price-label">输入文本价格</span>
|
|
||||||
<span class="ext-price-value">{{ price.input_text_tokens }}</span>
|
<span class="ext-price-value">{{ price.input_text_tokens }}</span>
|
||||||
<el-tag v-if="price.temp_input_text_tokens" type="warning" size="small" effect="light">
|
<el-tag v-if="price.temp_input_text_tokens" type="warning" size="small" effect="light" class="temp-tag">
|
||||||
待审核: {{ price.temp_input_text_tokens }}
|
{{ price.temp_input_text_tokens }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div v-if="hasSpecificPrice(price.output_text_tokens)" class="extended-price-item">
|
||||||
<template v-if="hasSpecificPrice(price.output_text_tokens)">
|
<span class="ext-price-label">文本输出</span>
|
||||||
<div class="extended-price-item">
|
|
||||||
<span class="ext-price-label">输出文本价格</span>
|
|
||||||
<span class="ext-price-value">{{ price.output_text_tokens }}</span>
|
<span class="ext-price-value">{{ price.output_text_tokens }}</span>
|
||||||
<el-tag v-if="price.temp_output_text_tokens" type="warning" size="small" effect="light">
|
<el-tag v-if="price.temp_output_text_tokens" type="warning" size="small" effect="light" class="temp-tag">
|
||||||
待审核: {{ price.temp_output_text_tokens }}
|
{{ price.temp_output_text_tokens }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div v-if="hasSpecificPrice(price.input_image_tokens)" class="extended-price-item">
|
||||||
<template v-if="hasSpecificPrice(price.input_image_tokens)">
|
<span class="ext-price-label">图片输入</span>
|
||||||
<div class="extended-price-item">
|
|
||||||
<span class="ext-price-label">输入图片价格</span>
|
|
||||||
<span class="ext-price-value">{{ price.input_image_tokens }}</span>
|
<span class="ext-price-value">{{ price.input_image_tokens }}</span>
|
||||||
<el-tag v-if="price.temp_input_image_tokens" type="warning" size="small" effect="light">
|
<el-tag v-if="price.temp_input_image_tokens" type="warning" size="small" effect="light" class="temp-tag">
|
||||||
待审核: {{ price.temp_input_image_tokens }}
|
{{ price.temp_input_image_tokens }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div v-if="hasSpecificPrice(price.output_image_tokens)" class="extended-price-item">
|
||||||
<template v-if="hasSpecificPrice(price.output_image_tokens)">
|
<span class="ext-price-label">图片输出</span>
|
||||||
<div class="extended-price-item">
|
|
||||||
<span class="ext-price-label">输出图片价格</span>
|
|
||||||
<span class="ext-price-value">{{ price.output_image_tokens }}</span>
|
<span class="ext-price-value">{{ price.output_image_tokens }}</span>
|
||||||
<el-tag v-if="price.temp_output_image_tokens" type="warning" size="small" effect="light">
|
<el-tag v-if="price.temp_output_image_tokens" type="warning" size="small" effect="light" class="temp-tag">
|
||||||
待审核: {{ price.temp_output_image_tokens }}
|
{{ price.temp_output_image_tokens }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div v-if="hasSpecificPrice(price.cached_tokens)" class="extended-price-item">
|
||||||
<template v-if="hasSpecificPrice(price.cached_tokens)">
|
<span class="ext-price-label">缓存</span>
|
||||||
<div class="extended-price-item">
|
|
||||||
<span class="ext-price-label">缓存价格</span>
|
|
||||||
<span class="ext-price-value">{{ price.cached_tokens }}</span>
|
<span class="ext-price-value">{{ price.cached_tokens }}</span>
|
||||||
<el-tag v-if="price.temp_cached_tokens" type="warning" size="small" effect="light">
|
<el-tag v-if="price.temp_cached_tokens" type="warning" size="small" effect="light" class="temp-tag">
|
||||||
待审核: {{ price.temp_cached_tokens }}
|
{{ price.temp_cached_tokens }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -1630,9 +1612,8 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.skeleton-row {
|
.skeleton {
|
||||||
padding: 10px;
|
min-height: 240px;
|
||||||
border-bottom: 1px solid #EBEEF5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-container {
|
.pagination-container {
|
||||||
@ -1736,24 +1717,24 @@ onMounted(() => {
|
|||||||
|
|
||||||
.price-cards-container {
|
.price-cards-container {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||||
gap: 1.2rem;
|
gap: 1rem;
|
||||||
padding: 1rem 0;
|
padding: 1rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.price-card {
|
.price-card {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 12px;
|
border-radius: 8px;
|
||||||
padding: 1.5rem;
|
padding: 1rem;
|
||||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 0.8rem;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: auto;
|
height: auto;
|
||||||
min-height: 280px;
|
min-height: 240px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.price-card:hover {
|
.price-card:hover {
|
||||||
@ -1767,7 +1748,7 @@ onMounted(() => {
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 6px;
|
height: 4px;
|
||||||
background: linear-gradient(to right, #36d1dc, #5b86e5);
|
background: linear-gradient(to right, #36d1dc, #5b86e5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1836,14 +1817,15 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.model-name {
|
.model-name {
|
||||||
font-size: 1.35rem;
|
font-size: 1.1rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #1f2937;
|
color: #1f2937;
|
||||||
margin: 0 0 0.75rem 0;
|
margin: 0 0 0.5rem 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
line-height: 1.3;
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-meta {
|
.model-meta {
|
||||||
@ -1856,11 +1838,11 @@ onMounted(() => {
|
|||||||
.price-info {
|
.price-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.7rem;
|
gap: 0.5rem;
|
||||||
margin-top: 0.75rem;
|
padding: 0.5rem;
|
||||||
padding: 0.75rem;
|
margin-top: 0.5rem;
|
||||||
background-color: #f9fafc;
|
background-color: #f9fafc;
|
||||||
border-radius: 8px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.price-row {
|
.price-row {
|
||||||
@ -1882,49 +1864,52 @@ onMounted(() => {
|
|||||||
|
|
||||||
.extended-prices {
|
.extended-prices {
|
||||||
border-top: 1px solid #f0f0f0;
|
border-top: 1px solid #f0f0f0;
|
||||||
padding-top: 1rem;
|
padding-top: 0.5rem;
|
||||||
margin-top: 0.5rem;
|
margin-top: 0.3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #606266;
|
color: #606266;
|
||||||
margin-bottom: 0.75rem;
|
font-size: 0.85rem;
|
||||||
font-size: 0.95rem;
|
margin-bottom: 0.5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.extended-price-grid {
|
.extended-price-grid {
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
flex-wrap: wrap;
|
||||||
gap: 0.75rem;
|
gap: 0.5rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.extended-price-item {
|
.extended-price-item {
|
||||||
display: flex;
|
font-size: 0.7rem;
|
||||||
flex-direction: column;
|
display: inline-flex;
|
||||||
gap: 0.25rem;
|
align-items: center;
|
||||||
padding: 0.75rem;
|
padding: 0.35rem 0.5rem;
|
||||||
background: #f9fafb;
|
background: #f9fafb;
|
||||||
border-radius: 8px;
|
border-radius: 4px;
|
||||||
border: 1px solid #f0f0f0;
|
border: 1px solid #f0f0f0;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
|
max-width: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
.extended-price-item:hover {
|
.extended-price-item:hover {
|
||||||
background: #f0f2f5;
|
background: #f0f2f5;
|
||||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ext-price-label {
|
.ext-price-label {
|
||||||
font-size: 0.8rem;
|
font-size: 0.7rem;
|
||||||
color: #606266;
|
color: #606266;
|
||||||
font-weight: 500;
|
margin-right: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ext-price-value {
|
.ext-price-value {
|
||||||
font-weight: 600;
|
font-weight: 500;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
font-size: 0.95rem;
|
font-size: 0.7rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.price-card-footer {
|
.price-card-footer {
|
||||||
@ -1958,7 +1943,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.skeleton {
|
.skeleton {
|
||||||
min-height: 300px;
|
min-height: 240px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-tag) {
|
:deep(.el-tag) {
|
||||||
@ -2094,6 +2079,18 @@ onMounted(() => {
|
|||||||
color: #C0C4CC;
|
color: #C0C4CC;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ext-price-label::after {
|
||||||
|
content: ": ";
|
||||||
|
}
|
||||||
|
|
||||||
|
.temp-tag {
|
||||||
|
margin-left: 4px;
|
||||||
|
font-size: 0.65rem !important;
|
||||||
|
height: 18px;
|
||||||
|
line-height: 16px;
|
||||||
|
padding: 0 4px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user