Fix mj hover price (#263)

This commit is contained in:
HCode authored and GitHub committed 2025-08-18 18:35:40 +08:00
1 parent 196ee79fcc
commit 3d32b84e9f
2 files changed
+19 -1

No files matched your search

@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix mj hover",
"packageName": "@acedatacloud/nexior",
"email": "1348977728@qq.com",
"dependentChangeType": "patch"
}
+12 -1
View File
@@ -62,7 +62,7 @@
:key="actionKey"
class="box-item"
effect="dark"
:content="descriptionMapping[action]"
:content="getActionDescriptionWithPrice(action, modelValue?.request?.mode)"
placement="top-start"
>
<el-button
@@ -322,6 +322,7 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
import ImageWrapper from '@/components/common/ImageWrapper.vue';
import VideoPlayer from '@/components/common/VideoPlayer.vue';
import { getConsumption } from '@/utils';
interface IData {
midjourneyImagineState: typeof MidjourneyImagineState;
actionMapping: Record<MidjourneyImagineAction, string>;
@@ -421,9 +422,19 @@ export default defineComponent({
},
config() {
return this.$store.state.midjourney?.config;
},
service() {
return this.$store.state.midjourney?.service;
}
},
methods: {
getActionDescriptionWithPrice(action: string, mode?: string): string {
// @ts-ignore
const baseDescription = this.descriptionMapping[action];
const price = getConsumption({ ...this.config, action: action, mode: mode }, this.service?.metadata?.price);
const unit = this.$t(`service.unit.${this.service?.unit || 'credits'}`);
return `${baseDescription} (${price} ${unit})`;
},
onCustom(action: string) {
if (this.modelValue?.type === 'imagine') {
this.$emit('custom', {