fix init error
This commit is contained in:
1 parent
34a12e85bc
commit
c38d6ba67c
15 files changed
+136
-8
No files matched your search
@@ -1,15 +1,28 @@
|
||||
<template>
|
||||
<markdown-renderer :content="content?.value" class="content" />
|
||||
<answering-mark v-if="shouldShowAnsweringMark" />
|
||||
<el-alert v-if="errorText" :title="errorText" type="error" :closable="false" />
|
||||
<div class="alerts">
|
||||
<el-alert v-if="errorText" :title="errorText" type="error" :closable="false" />
|
||||
</div>
|
||||
<div class="operations pt-2 ml-2">
|
||||
<el-button v-if="shouldBuyMore" type="primary" size="small" @click="onBuyMore">{{
|
||||
$t('common.button.buyMore')
|
||||
}}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IContent, IError, IMessageState } from '@/operators/message/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||
import { ElAlert } from 'element-plus';
|
||||
import { ERROR_CODE_API_ERROR, ERROR_CODE_BUSY, ERROR_CODE_BAD_REQUEST, ERROR_CODE_NO_CONVERSATION } from '@/constants';
|
||||
import { ElAlert, ElButton } from 'element-plus';
|
||||
import {
|
||||
ERROR_CODE_API_ERROR,
|
||||
ERROR_CODE_BUSY,
|
||||
ERROR_CODE_BAD_REQUEST,
|
||||
ERROR_CODE_NO_CONVERSATION,
|
||||
ERROR_CODE_USED_UP
|
||||
} from '@/constants';
|
||||
import AnsweringMark from './AnsweringMark.vue';
|
||||
|
||||
export default defineComponent({
|
||||
@@ -17,7 +30,8 @@ export default defineComponent({
|
||||
components: {
|
||||
MarkdownRenderer,
|
||||
ElAlert,
|
||||
AnsweringMark
|
||||
AnsweringMark,
|
||||
ElButton
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
@@ -47,7 +61,14 @@ export default defineComponent({
|
||||
// @ts-ignore
|
||||
return this.state === IMessageState.PENDING;
|
||||
},
|
||||
shouldBuyMore() {
|
||||
// @ts-ignore
|
||||
return this.error?.code === ERROR_CODE_USED_UP;
|
||||
},
|
||||
errorText() {
|
||||
if (this.error?.code === ERROR_CODE_USED_UP) {
|
||||
return this.$t('conversation.message.errorUsedUp');
|
||||
}
|
||||
if (this.error?.code === ERROR_CODE_BUSY) {
|
||||
return this.$t('conversation.message.errorBusy');
|
||||
}
|
||||
@@ -62,6 +83,11 @@ export default defineComponent({
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onBuyMore() {
|
||||
window.open('https://data.zhishuyun.com/services/b1fbcc32-e218-4253-9dc3-4fe600a1bfb9', '_blank');
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</template>
|
||||
</el-input>
|
||||
<div v-if="!application" class="new-message-apply">
|
||||
<div v-if="initializing">
|
||||
<div v-if="!initializing">
|
||||
<span class="mr-2">{{ $t('conversation.message.apiInfo') }}</span>
|
||||
<span>
|
||||
<el-button type="primary" size="small" @click="confirming = true">
|
||||
|
||||
Reference in new issue
Block a user