Commit b501a72d by renyizhao

图标问题,用户消费显示按次按量

parent 113f2ac4
...@@ -17,7 +17,10 @@ ...@@ -17,7 +17,10 @@
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "2.3.1", "@element-plus/icons-vue": "2.3.1",
"@iconify/json": "^2.2.486",
"@iconify/vue": "^5.0.1",
"@lobehub/icons": "^5.10.0", "@lobehub/icons": "^5.10.0",
"@lobehub/icons-static-svg": "^1.91.0",
"@vueup/vue-quill": "1.2.0", "@vueup/vue-quill": "1.2.0",
"@vueuse/core": "10.6.1", "@vueuse/core": "10.6.1",
"axios": "0.27.2", "axios": "0.27.2",
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
</el-tooltip> </el-tooltip>
</el-form-item> </el-form-item>
<el-form-item label="服务地址:"> <el-form-item label="服务地址:">
<el-tooltip effect="dark" :content="baseUrl" placement="top"> <el-tooltip effect="dark" content="http://phslgld.hnluchuan.com:3000/" placement="top">
<span class="secret-text">{{ baseUrl }}</span> <span class="secret-text">http://phslgld.hnluchuan.com:3000/</span>
</el-tooltip> </el-tooltip>
</el-form-item> </el-form-item>
</el-form> </el-form>
......
...@@ -61,6 +61,13 @@ ...@@ -61,6 +61,13 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="模型" align="center" prop="model_name" min-width="180" /> <el-table-column label="模型" align="center" prop="model_name" min-width="180" />
<el-table-column label="计费方式" align="center" width="100">
<template #default="scope">
<el-tag :type="getBillingType(scope.row.other) === '按次' ? 'success' : 'primary'" size="small">
{{ getBillingType(scope.row.other) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="输入" align="center" prop="prompt_tokens" width="120"> <el-table-column label="输入" align="center" prop="prompt_tokens" width="120">
<template #default="scope"> <template #default="scope">
<span>{{ scope.row.prompt_tokens || 0 }}</span> <span>{{ scope.row.prompt_tokens || 0 }}</span>
...@@ -294,6 +301,20 @@ function extractRechargeAmount(content) { ...@@ -294,6 +301,20 @@ function extractRechargeAmount(content) {
return Number(match[1]).toFixed(2) return Number(match[1]).toFixed(2)
} }
/** 解析计费方式:按次(model_ratio===0 && model_price!==-1) vs 按量 */
function getBillingType(other) {
if (!other) return '-'
try {
const info = typeof other === 'string' ? JSON.parse(other) : other
const ratio = Number(info.model_ratio)
const price = Number(info.model_price)
if (isNaN(ratio) || isNaN(price)) return '-'
return ratio === 0 && price !== -1 ? '按次' : '按量'
} catch {
return '-'
}
}
onMounted(() => { onMounted(() => {
refresh() refresh()
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment