Spaces:
Running
Running
Remove date suffix from model names in LiveView and AgentFilters (models filter)
Browse files
src/components/AgentFilters.vue
CHANGED
|
@@ -63,7 +63,7 @@
|
|
| 63 |
<div class="flex flex-column gap-1">
|
| 64 |
<div v-for="opt in modelOptions" :key="`model_${opt.value}`" class="flex align-items-center gap-1">
|
| 65 |
<Checkbox v-model="modelsModel" :inputId="`model_${opt.value}`" :value="opt.value" />
|
| 66 |
-
<label :for="`model_${opt.value}`" class="opt-label">{{ opt.label }}</label>
|
| 67 |
</div>
|
| 68 |
</div>
|
| 69 |
</div>
|
|
@@ -179,6 +179,10 @@ export default {
|
|
| 179 |
}
|
| 180 |
},
|
| 181 |
methods: {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
initializeSlider() {
|
| 183 |
if (this.hasDateBounds) {
|
| 184 |
// 查找 2025-08-01 在日期数组中的索引
|
|
|
|
| 63 |
<div class="flex flex-column gap-1">
|
| 64 |
<div v-for="opt in modelOptions" :key="`model_${opt.value}`" class="flex align-items-center gap-1">
|
| 65 |
<Checkbox v-model="modelsModel" :inputId="`model_${opt.value}`" :value="opt.value" />
|
| 66 |
+
<label :for="`model_${opt.value}`" class="opt-label">{{ formatModelName(opt.label) }}</label>
|
| 67 |
</div>
|
| 68 |
</div>
|
| 69 |
</div>
|
|
|
|
| 179 |
}
|
| 180 |
},
|
| 181 |
methods: {
|
| 182 |
+
formatModelName(model) {
|
| 183 |
+
if (!model) return ''
|
| 184 |
+
return model.replace(/_?\d{8}$/, '')
|
| 185 |
+
},
|
| 186 |
initializeSlider() {
|
| 187 |
if (this.hasDateBounds) {
|
| 188 |
// 查找 2025-08-01 在日期数组中的索引
|
src/views/LiveView.vue
CHANGED
|
@@ -230,6 +230,11 @@ onBeforeUnmount(() => {
|
|
| 230 |
})
|
| 231 |
|
| 232 |
/* ---------- helpers ---------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
const asRatio = (x) => {
|
| 234 |
if (x == null || Number.isNaN(x)) return null;
|
| 235 |
// if |x| > 1.2 we assume it's already a % number (e.g., 58 or -79.23), convert to ratio
|
|
@@ -435,7 +440,7 @@ watch(
|
|
| 435 |
key: `agent|${sel.agent_name}|${sel.model}`,
|
| 436 |
kind: 'agent',
|
| 437 |
title: sel.agent_name,
|
| 438 |
-
subtitle: sel.model,
|
| 439 |
balance: perf.stratLast,
|
| 440 |
date: maxEndDate || perf.date, // Use max date from Supabase
|
| 441 |
logo: AGENT_LOGOS[sel.agent_name] || null,
|
|
|
|
| 230 |
})
|
| 231 |
|
| 232 |
/* ---------- helpers ---------- */
|
| 233 |
+
const formatModelName = (model) => {
|
| 234 |
+
if (!model) return ''
|
| 235 |
+
return model.replace(/_?\d{8}$/, '')
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
const asRatio = (x) => {
|
| 239 |
if (x == null || Number.isNaN(x)) return null;
|
| 240 |
// if |x| > 1.2 we assume it's already a % number (e.g., 58 or -79.23), convert to ratio
|
|
|
|
| 440 |
key: `agent|${sel.agent_name}|${sel.model}`,
|
| 441 |
kind: 'agent',
|
| 442 |
title: sel.agent_name,
|
| 443 |
+
subtitle: formatModelName(sel.model),
|
| 444 |
balance: perf.stratLast,
|
| 445 |
date: maxEndDate || perf.date, // Use max date from Supabase
|
| 446 |
logo: AGENT_LOGOS[sel.agent_name] || null,
|