fix init error

This commit is contained in:
AceDataCloud committed 2023-04-09 12:47:34 +08:00
1 parent 34a12e85bc
commit c38d6ba67c
15 files changed
+136 -8

No files matched your search

+30 -4
View File
@@ -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">
+1
View File
@@ -4,3 +4,4 @@ export const ERROR_CODE_BUSY = 'busy';
export const ERROR_CODE_API_ERROR = 'api_error';
export const ERROR_CODE_BAD_REQUEST = 'bad_request';
export const ERROR_CODE_NO_CONVERSATION = 'no_conversation';
export const ERROR_CODE_USED_UP = 'used_up';
+15
View File
@@ -0,0 +1,15 @@
export default {
requestQueries: 'URL参数',
requestBody: '请求体',
responseBody: '响应体',
requestHeaders: '请求头',
requestHeader: '请求头',
responseHeaders: '响应头',
response: '响应',
success: '成功',
failure: '失败',
responseExample: '样例',
authentication: '认证',
arrayOf: '列表',
apiKey: 'API Key'
};
+9
View File
@@ -0,0 +1,9 @@
import entity from './entity';
import unit from './unit';
import message from './message';
export default {
entity,
unit,
message
};
+8
View File
@@ -0,0 +1,8 @@
export default {
free: '免费',
appliedCount: '申请次数',
firstFree: '首次送',
custom: '指定次数',
present: '赠送',
around: '约'
};
+3
View File
@@ -0,0 +1,3 @@
export default {
Count: '次'
};
+7
View File
@@ -0,0 +1,7 @@
export default {
goDocument: '查看文档',
buyMore: '购买更多',
createOrder: '创建订单',
custom: '自定义',
query: '查询'
};
+18
View File
@@ -0,0 +1,18 @@
export default {
id: '申请ID',
remainingAmount: '剩余量',
usedAmount: '使用量',
apiKey: 'API Key',
service: '服务',
operation: '操作',
amount: '数量',
shouldPayPrice: '应付金额',
api: 'API',
proxy: '代理',
credential: '密钥',
name: '名称',
package: '套餐',
type: '类型',
freeAmount: '免费赠送',
extraPrice: '价格'
};
+11
View File
@@ -0,0 +1,11 @@
import field from './field';
import button from './button';
import message from './message';
import title from './title';
export default {
field,
button,
message,
title
};
+21
View File
@@ -0,0 +1,21 @@
export default {
alreadyApplied: '已经申请过该服务',
applySuccessfully: '申请成功',
notApplied: '你尚未申请过该服务,请先申请该服务之后使用',
yourApplication: '你的申请',
unverified: '您需要完成实名认证之后方可申请该服务',
goVerify: '去实名认证',
requiredParameter: '必填参数',
example: '样例',
readPolicy: '我已阅读并同意',
policy: '《数据技术服务使用协议》',
notAgreePolicy: '您尚未同意《数据技术服务使用协议》',
confirmApplying: '申请服务确认',
rotateCredential: '重置密钥',
rotateCredentialConfirm: '你确定要重置密钥吗?重置后不可恢复',
idDoesNotExist: '申请不存在',
rotateCredentialSuccessfully: '密钥重置成功',
rotateCredentialFailed: '密钥重置失败,请联系客服处理',
updateFailed: '修改失败',
updateSuccessfully: '修改成功'
};
+5
View File
@@ -0,0 +1,5 @@
export default {
buyService: '购买服务',
applicationRemainingCount: '次数修改',
manageApplication: '申请管理'
};
+2 -1
View File
@@ -18,5 +18,6 @@ export default {
errorApiError: '回答失败,请稍后重试',
errorBadRequest: '请求内容不规范,请重新提问',
errorNoConversation: '对话内容不存在或者已经过期,请发起新的会话',
confirmDelete: '确定删除'
confirmDelete: '确定删除',
errorUsedUp: '您的套餐次数已经用完,请购买更多次数继续使用'
};
+5 -1
View File
@@ -1,9 +1,13 @@
import common from './common';
import auth from './auth';
import conversation from './conversation';
import application from './application';
import api from './api';
export default {
common,
conversation,
auth
auth,
application,
api
};
-1
View File
@@ -213,7 +213,6 @@ export default defineComponent({
onDraft(content: string) {
this.input = content;
},
onSend() {
if (this.answering) {
return;