update model selector
This commit is contained in:
1 parent
aef00375d7
commit
48e6d1bfb4
3 files changed
+25
-5
No files matched your search
@@ -85,6 +85,9 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onSwitchGroup(group: any) {
|
onSwitchGroup(group: any) {
|
||||||
|
if (this.activeGroup === group.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.activeGroup = group.value;
|
this.activeGroup = group.value;
|
||||||
const options = group.options;
|
const options = group.options;
|
||||||
if (options && options.length > 0) {
|
if (options && options.length > 0) {
|
||||||
@@ -105,8 +108,9 @@ export default defineComponent({
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.model-selector {
|
.model-selector {
|
||||||
background-color: #ececf1;
|
background-color: #ececf1;
|
||||||
padding: 7px;
|
padding: 7px 6px;
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
|
margin-bottom: 5px;
|
||||||
.group {
|
.group {
|
||||||
padding: 20px 30px;
|
padding: 20px 30px;
|
||||||
color: black;
|
color: black;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<span v-if="application">
|
<span v-if="application && !initializing" class="info">
|
||||||
{{ $t('conversation.message.usedCount') }}: {{ application?.used_amount }}
|
{{ $t('conversation.message.usedCount') }}: {{ application?.used_amount }}
|
||||||
{{ $t('conversation.message.remainingCount') }}: {{ application?.remaining_amount }}
|
{{ $t('conversation.message.remainingCount') }}: {{ application?.remaining_amount }}
|
||||||
</span>
|
</span>
|
||||||
@@ -8,14 +8,21 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { IApplication } from '@/operators';
|
import { IApplication } from '@/operators';
|
||||||
|
import { ElSkeleton } from 'element-plus';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ApiStatus',
|
name: 'ApiStatus',
|
||||||
components: {},
|
components: {
|
||||||
|
ElSkeleton
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
application: {
|
application: {
|
||||||
type: Object as () => IApplication,
|
type: Object as () => IApplication,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
initializing: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -26,4 +33,9 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss"></style>
|
<style lang="scss">
|
||||||
|
.info {
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--el-color-black);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<model-selector v-model="model" class="model-selector" @select="onLoadModel" />
|
<model-selector v-model="model" class="model-selector" @select="onLoadModel" />
|
||||||
<api-status v-if="application" :application="application" />
|
<api-status v-if="application" :application="application" :initializing="initializing" />
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<introduction v-if="messages && messages.length === 0" />
|
<introduction v-if="messages && messages.length === 0" />
|
||||||
<div v-else class="messages">
|
<div v-else class="messages">
|
||||||
@@ -41,6 +41,7 @@ export interface IData {
|
|||||||
model: IChatModel;
|
model: IChatModel;
|
||||||
application: IApplication | undefined;
|
application: IApplication | undefined;
|
||||||
question: '';
|
question: '';
|
||||||
|
initializing: boolean;
|
||||||
applied: boolean | undefined;
|
applied: boolean | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +58,7 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
model: CHAT_MODEL_CHATGPT,
|
model: CHAT_MODEL_CHATGPT,
|
||||||
question: '',
|
question: '',
|
||||||
|
initializing: false,
|
||||||
applied: undefined,
|
applied: undefined,
|
||||||
application: undefined,
|
application: undefined,
|
||||||
messages: [
|
messages: [
|
||||||
@@ -113,10 +115,12 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async onLoadModel() {
|
async onLoadModel() {
|
||||||
|
this.initializing = true;
|
||||||
const { data: applications } = await applicationOperator.getAll({
|
const { data: applications } = await applicationOperator.getAll({
|
||||||
user_id: this.$store.state.user.id,
|
user_id: this.$store.state.user.id,
|
||||||
api_id: this.model.apiId
|
api_id: this.model.apiId
|
||||||
});
|
});
|
||||||
|
this.initializing = false;
|
||||||
if (!applications || applications?.items?.length === 0) {
|
if (!applications || applications?.items?.length === 0) {
|
||||||
this.applied = false;
|
this.applied = false;
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in new issue
Block a user