Update application structure (#224)
Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
1 parent
d49b7e6f6c
commit
9ae4229256
135 files changed
+2849
-2324
No files matched your search
@@ -1,32 +1,42 @@
|
||||
<template>
|
||||
<span v-if="application.type === 'Period'" class="info">
|
||||
<el-tag v-if="showType" type="primary" class="mr-1" effect="dark">
|
||||
{{ $t('application.type.period') }}
|
||||
</el-tag>
|
||||
{{ $t('common.message.expiredAt') }}:
|
||||
{{ $dayjs.format(application.expired_at) }}
|
||||
<p v-if="showId" class="subtitle">ID: {{ application.id }}</p>
|
||||
</span>
|
||||
<span v-if="application.type === 'Usage'" type="success" class="info" effect="dark">
|
||||
<el-tag v-if="showType" class="mr-1">
|
||||
{{ $t('application.type.usage') }}
|
||||
</el-tag>
|
||||
{{ $t('common.message.remainingAmount') }}:
|
||||
{{ application?.remaining_amount?.toFixed(6) }}
|
||||
{{ $t(`service.unit.` + application?.service?.unit + 's') }}
|
||||
<p v-if="showId" class="subtitle">ID: {{ application.id }}</p>
|
||||
</span>
|
||||
<el-descriptions :column="1" class="flex flex-col">
|
||||
<el-descriptions-item :label="$t('application.field.serviceName')">{{
|
||||
application.service?.title
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('application.field.id')">
|
||||
<span>{{ application.id }}</span>
|
||||
<copy-to-clipboard v-if="application.id" :content="application.id" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('application.field.type')">
|
||||
<el-tag v-if="application.type === 'Period'" effect="dark" round>
|
||||
{{ $t('application.type.period') }}
|
||||
</el-tag>
|
||||
<el-tag v-if="application.type === 'Usage'" effect="dark" round>
|
||||
{{ $t('application.type.usage') }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="application.type === 'Period'" :label="$t('application.field.expiredAt')">
|
||||
{{ $dayjs.format(application.expired_at) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('application.field.remainingAmount')">
|
||||
{{ application?.remaining_amount?.toFixed(6) }} {{ $t(`service.unit.` + application?.service?.unit + 's') }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IApplication } from '@/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElTag } from 'element-plus';
|
||||
import { ElTag, ElDescriptions, ElDescriptionsItem } from 'element-plus';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApplicationInfo',
|
||||
components: {
|
||||
ElTag
|
||||
ElTag,
|
||||
CopyToClipboard,
|
||||
ElDescriptions,
|
||||
ElDescriptionsItem
|
||||
},
|
||||
props: {
|
||||
application: {
|
||||
|
||||
@@ -1,39 +1,48 @@
|
||||
<template>
|
||||
<div class="element">
|
||||
<div v-if="initializing && application === undefined">
|
||||
<el-skeleton :rows="1" class="text-center">
|
||||
<template #template>
|
||||
<el-skeleton-item variant="p" class="shimmer" />
|
||||
</template>
|
||||
</el-skeleton>
|
||||
</div>
|
||||
<div v-else-if="application" class="status">
|
||||
<el-dropdown @command="onSelectApplication">
|
||||
<span class="el-dropdown-link">
|
||||
<application-info :application="application" />
|
||||
<el-icon v-if="applications && applications.length > 0" class="el-icon--right ml-0">
|
||||
<arrow-down />
|
||||
</el-icon>
|
||||
<el-dialog v-model="showInfo" width="500px">
|
||||
<div v-if="initializing && application === undefined">
|
||||
<el-skeleton :rows="1" class="text-center">
|
||||
<template #template>
|
||||
<el-skeleton-item variant="p" class="shimmer" />
|
||||
</template>
|
||||
</el-skeleton>
|
||||
</div>
|
||||
<div v-else-if="application" class="status">
|
||||
<p class="text-left mb-4">
|
||||
{{ $t('application.message.applicationSelection') }}
|
||||
</p>
|
||||
<div class="applications flex flex-col gap-2 mb-6">
|
||||
<div
|
||||
v-for="(app, index) in applications"
|
||||
:key="index"
|
||||
:class="{
|
||||
item: true,
|
||||
active: application?.id === app.id
|
||||
}"
|
||||
@click="onSelectApplication(app)"
|
||||
>
|
||||
<el-icon class="icon"><check /></el-icon>
|
||||
<application-info :application="app" :show-type="true" :show-id="true" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<el-button round type="primary" @click="onBuyMore(application)">{{ $t('common.button.buyMore') }}</el-button>
|
||||
</div>
|
||||
<span class="actions">
|
||||
<api-price
|
||||
v-if="showPrice && application?.service?.apis?.[0]?.price"
|
||||
class="price inline-block"
|
||||
:price="application?.service?.apis?.[0]?.price"
|
||||
/>
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu v-if="applications && applications.length > 0">
|
||||
<el-dropdown-item v-for="(app, index) in applications" :key="index" :command="app">
|
||||
<application-info :application="app" :show-type="true" :show-id="true" />
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<span class="actions">
|
||||
<el-button round size="small" type="primary" class="mr-1" @click="onBuyMore(application)">{{
|
||||
$t('common.button.buyMore')
|
||||
}}</el-button>
|
||||
<api-price
|
||||
v-if="showPrice && application?.service?.apis?.[0]?.price"
|
||||
class="price inline-block"
|
||||
:price="application?.service?.apis?.[0]?.price"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-tooltip effect="dark" placement="top-start">
|
||||
<el-button circle @click="showInfo = true">
|
||||
<font-awesome-icon icon="fa-solid fa-wallet" class="icon" />
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<div v-if="needApply && service" class="text-center info">
|
||||
<span class="mr-2">{{ $t('chat.message.notApplied') }}</span>
|
||||
<span>
|
||||
@@ -55,25 +64,18 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { applicationOperator, credentialOperator } from '@/operators';
|
||||
import {
|
||||
ElButton,
|
||||
ElMessage,
|
||||
ElSkeleton,
|
||||
ElSkeletonItem,
|
||||
ElDropdown,
|
||||
ElDropdownItem,
|
||||
ElIcon,
|
||||
ElDropdownMenu
|
||||
} from 'element-plus';
|
||||
import { ElButton, ElMessage, ElSkeleton, ElSkeletonItem, ElIcon, ElDialog } from 'element-plus';
|
||||
import ApplicationConfirm from '@/components/application/Confirm.vue';
|
||||
import { IApplicationType, IApplication, IApplicationDetailResponse, IService } from '@/models';
|
||||
import { ERROR_CODE_DUPLICATION } from '@/constants/errorCode';
|
||||
import { ROUTE_CONSOLE_APPLICATION_SUBSCRIBE } from '@/router';
|
||||
import ApiPrice from '@/components/api/Price.vue';
|
||||
import { ArrowDown } from '@element-plus/icons-vue';
|
||||
import { Check } from '@element-plus/icons-vue';
|
||||
import ApplicationInfo from './Info.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
export interface IData {
|
||||
showInfo: boolean;
|
||||
confirming: boolean;
|
||||
applicationType: typeof IApplicationType;
|
||||
}
|
||||
@@ -82,15 +84,14 @@ export default defineComponent({
|
||||
name: 'ApplicationStatus',
|
||||
components: {
|
||||
ElButton,
|
||||
Check,
|
||||
ElDialog,
|
||||
FontAwesomeIcon,
|
||||
ApplicationInfo,
|
||||
ApplicationConfirm,
|
||||
ElSkeleton,
|
||||
ElSkeletonItem,
|
||||
ApiPrice,
|
||||
ElDropdown,
|
||||
ElDropdownMenu,
|
||||
ElDropdownItem,
|
||||
ArrowDown,
|
||||
ElIcon
|
||||
},
|
||||
props: {
|
||||
@@ -122,6 +123,7 @@ export default defineComponent({
|
||||
emits: ['apply', 'refresh', 'applied', 'update:application', 'select'],
|
||||
data(): IData {
|
||||
return {
|
||||
showInfo: false,
|
||||
confirming: this.needApply,
|
||||
applicationType: IApplicationType
|
||||
};
|
||||
@@ -210,6 +212,37 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
.applications {
|
||||
.item {
|
||||
cursor: pointer;
|
||||
padding: 20px;
|
||||
background-color: var(--el-bg-color);
|
||||
border-radius: 15px;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
.icon {
|
||||
visibility: hidden;
|
||||
}
|
||||
&.active {
|
||||
.icon {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
background-color: var(--el-bg-color-page);
|
||||
}
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
.icon {
|
||||
color: var(--el-color-white);
|
||||
font-size: 20px;
|
||||
background-color: var(--el-color-primary);
|
||||
border-radius: 50%;
|
||||
padding: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.actions {
|
||||
margin: 0 5px;
|
||||
display: inline-block;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-tooltip v-if="!copied" effect="dark" :content="$t('common.button.copy')" placement="bottom">
|
||||
<font-awesome-icon icon="fa-regular fa-copy" class="icon-copy" @click="onCopy"
|
||||
<font-awesome-icon icon="fa-regular fa-copy" class="icon-copy" @click.stop="onCopy"
|
||||
/></el-tooltip>
|
||||
<el-tooltip v-else :visible="copied" effect="dark" :content="$t('common.message.copied')" placement="bottom">
|
||||
<font-awesome-icon icon="fa-solid fa-check" class="icon-check" />
|
||||
|
||||
@@ -98,7 +98,7 @@ export default defineComponent({
|
||||
name: ROUTE_DEEPSEEK_CONVERSATION_NEW
|
||||
},
|
||||
displayName: this.$t('common.nav.deepseek'),
|
||||
logo: 'https://cdn.acedata.cloud/bc71ae.png',
|
||||
logo: 'https://cdn.acedata.cloud/4rb23t.jpg',
|
||||
routes: [ROUTE_DEEPSEEK_CONVERSATION, ROUTE_DEEPSEEK_CONVERSATION_NEW]
|
||||
});
|
||||
}
|
||||
@@ -246,7 +246,7 @@ export default defineComponent({
|
||||
&[direction='row'] {
|
||||
flex-direction: row;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid var(--el-border-color);
|
||||
border-top: 1px solid var(--el-border-color-lighter);
|
||||
.chevron,
|
||||
.logo {
|
||||
display: none;
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
}"
|
||||
@click="onToggle(item)"
|
||||
>
|
||||
<el-icon class="icon"><check /></el-icon>
|
||||
<el-image :src="item.image" fit="fill" class="preview" />
|
||||
<span class="name">{{ item.label }}</span>
|
||||
</div>
|
||||
@@ -55,8 +56,9 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElTabs, ElTabPane, ElImage, ElDialog, ElButton, ElTag } from 'element-plus';
|
||||
import { ElTabs, ElTabPane, ElImage, ElDialog, ElButton, ElTag, ElIcon } from 'element-plus';
|
||||
import InfoIcon from '@/components/common/InfoIcon.vue';
|
||||
import { Check } from '@element-plus/icons-vue';
|
||||
|
||||
interface IElementItem {
|
||||
image: string;
|
||||
@@ -79,8 +81,10 @@ interface IData {
|
||||
export default defineComponent({
|
||||
name: 'ElementsSelector',
|
||||
components: {
|
||||
Check,
|
||||
ElTabs,
|
||||
ElTag,
|
||||
ElIcon,
|
||||
ElTabPane,
|
||||
ElImage,
|
||||
ElDialog,
|
||||
@@ -2142,31 +2146,48 @@ export default defineComponent({
|
||||
flex-wrap: wrap;
|
||||
height: 230px;
|
||||
overflow-y: auto;
|
||||
gap: 10px;
|
||||
.item {
|
||||
$height: 100px;
|
||||
$width: 100px;
|
||||
position: relative;
|
||||
width: $width;
|
||||
height: $height;
|
||||
margin-right: 8px;
|
||||
margin-bottom: 8px;
|
||||
border-width: 3px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: var(--el-border-color);
|
||||
border-radius: 5px;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 100;
|
||||
color: var(--el-color-white);
|
||||
font-size: 20px;
|
||||
background-color: var(--el-color-primary);
|
||||
border-radius: 50%;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
&.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--el-color-primary);
|
||||
.icon {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
|
||||
.preview {
|
||||
width: $height - 8px;
|
||||
height: $width - 8px;
|
||||
width: $height;
|
||||
height: $width;
|
||||
}
|
||||
.name {
|
||||
position: absolute;
|
||||
@@ -2174,7 +2195,8 @@ export default defineComponent({
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: $width;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
text-overflow: ellipsis;
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
color: white;
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
|
||||
@@ -95,6 +95,12 @@
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
</p>
|
||||
<p class="description">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('midjourney.field.traceId') }}:
|
||||
{{ modelValue?.trace_id }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" class="btn-copy" />
|
||||
</p>
|
||||
<p class="description">
|
||||
<font-awesome-icon icon="fa-solid fa-image" class="mr-1" />
|
||||
{{ $t('midjourney.field.imageId') }}:
|
||||
@@ -124,6 +130,7 @@ import { ElImage, ElButton, ElTooltip, ElAlert } from 'element-plus';
|
||||
import { IMidjourneyTask, MidjourneyImagineAction, MidjourneyImagineState } from '@/models';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
import { Check } from '@element-plus/icons-vue';
|
||||
|
||||
interface IData {
|
||||
midjourneyImagineState: typeof MidjourneyImagineState;
|
||||
@@ -348,12 +355,12 @@ $left-width: 70px;
|
||||
.image-wrapper {
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
min-height: 50px;
|
||||
min-width: 100px;
|
||||
margin-bottom: 15px;
|
||||
.image {
|
||||
max-height: 400px;
|
||||
max-width: 300px;
|
||||
min-height: 200px;
|
||||
min-width: 200px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.btn-raw {
|
||||
|
||||
@@ -76,7 +76,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
.tasks {
|
||||
padding: 0 10px;
|
||||
padding: 10px;
|
||||
overflow-y: scroll;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
Reference in new issue
Block a user