diff --git a/src/components/application/Confirm.vue b/src/components/application/Confirm.vue index 5b225d8..a9aa7e7 100644 --- a/src/components/application/Confirm.vue +++ b/src/components/application/Confirm.vue @@ -29,7 +29,7 @@ {{ $t('application.message.policy') }} - {{ $t('common.button.apply') }} + {{ $t('common.button.apply') }} @@ -59,7 +59,7 @@ export default defineComponent({ }, props: { object: { - type: Object as () => IApi, + type: Object as () => IApi | undefined, required: true }, type: { @@ -96,8 +96,12 @@ export default defineComponent({ diff --git a/src/components/common/Navigator.vue b/src/components/common/Navigator.vue index b500c84..cc33fd0 100644 --- a/src/components/common/Navigator.vue +++ b/src/components/common/Navigator.vue @@ -7,15 +7,22 @@ -
+
+
+ +
@@ -49,7 +63,9 @@ export default defineComponent({ display: flex; flex-direction: column; align-items: center; - .top { + + .top, + .bottom { display: flex; flex-direction: column; padding-top: 10px; @@ -71,8 +87,9 @@ export default defineComponent({ } } .bottom { - display: flex; - flex-direction: column; + display: block; + position: absolute; + bottom: 0; } } diff --git a/src/i18n/zh/chat/message.ts b/src/i18n/zh/chat/message.ts index 3f697e2..f171a82 100644 --- a/src/i18n/zh/chat/message.ts +++ b/src/i18n/zh/chat/message.ts @@ -3,7 +3,7 @@ export default { noToken: '请先申请对应服务', newMessagePlaceholder: '请输入你的问题...', noInput: '问题不能为空', - apiInfo: '本服务由「知数云」提供技术支持', + notApplied: '您尚未申请该服务,请先申请', tryForFree: '免费使用', initializing: '初始化中,请稍后...', writeCode: '写一段 JavaScript 代码,输出 Hello World', diff --git a/src/operators/application/models.ts b/src/operators/application/models.ts index 0d7313e..ceb50aa 100644 --- a/src/operators/application/models.ts +++ b/src/operators/application/models.ts @@ -20,7 +20,7 @@ export interface ICredential { } export interface IApplication { - id: string; + id?: string; api?: IApi; type?: IApplicationType; api_id?: string; diff --git a/src/operators/chat/constants.ts b/src/operators/chat/constants.ts index fc2a586..f4626b7 100644 --- a/src/operators/chat/constants.ts +++ b/src/operators/chat/constants.ts @@ -19,29 +19,29 @@ export const API_ID_CHATGPT4_BROWSING = 'a61de51b-d0d0-48a2-9a17-1d4986d5d497'; export const CHAT_MODEL_CHATGPT: IChatModel = { apiId: API_ID_CHATGPT, name: CHAT_MODEL_NAME_CHATGPT, - displayName: '基础 - 4k' + displayName: '3.5 - 标准' }; export const CHAT_MODEL_CHATGPT_16K: IChatModel = { apiId: API_ID_CHATGPT_16K, name: CHAT_MODEL_NAME_CHATGPT_16K, - displayName: '基础 - 16k' + displayName: '3.5 - 16k' }; export const CHAT_MODEL_CHATGPT_BROWSING: IChatModel = { apiId: API_ID_CHATGPT_BROWSING, name: CHAT_MODEL_NAME_CHATGPT_BROWSING, - displayName: '基础 - 联网版' + displayName: '3.5 - 联网版' }; export const CHAT_MODEL_CHATGPT4: IChatModel = { apiId: API_ID_CHATGPT4, name: CHAT_MODEL_NAME_CHATGPT4, - displayName: 'Plus - 4.0' + displayName: '4.0 - 标准' }; export const CHAT_MODEL_CHATGPT4_BROWSING: IChatModel = { apiId: API_ID_CHATGPT4_BROWSING, name: CHAT_MODEL_NAME_CHATGPT4_BROWSING, - displayName: 'Plus - 4.0 联网版' + displayName: '4.0 - 联网版' }; diff --git a/src/operators/index.ts b/src/operators/index.ts index f290f7a..1d5b492 100644 --- a/src/operators/index.ts +++ b/src/operators/index.ts @@ -4,3 +4,4 @@ export * from './user'; export * from './chat'; export * from './midjourney'; export * from './usage'; +export * from './api'; diff --git a/src/pages/chat/Conversation.vue b/src/pages/chat/Conversation.vue index f0d71d9..8a66cab 100644 --- a/src/pages/chat/Conversation.vue +++ b/src/pages/chat/Conversation.vue @@ -3,7 +3,7 @@
- +
diff --git a/src/pages/midjourney/History.vue b/src/pages/midjourney/History.vue index c2e9d34..9455aa4 100644 --- a/src/pages/midjourney/History.vue +++ b/src/pages/midjourney/History.vue @@ -5,7 +5,7 @@
- + diff --git a/src/pages/midjourney/Index.vue b/src/pages/midjourney/Index.vue index a4d41e1..2096b5c 100644 --- a/src/pages/midjourney/Index.vue +++ b/src/pages/midjourney/Index.vue @@ -5,7 +5,7 @@
- +
@@ -43,11 +43,13 @@ import { applicationOperator, midjourneyOperator, IMidjourneyImagineTask, - IMidjourneyImagineRequest + IMidjourneyImagineRequest, + IApplicationDetailResponse } from '@/operators'; import ApiStatus from '@/components/common/ApiStatus.vue'; import TaskBriefList from '@/components/midjourney/tasks/TaskBriefList.vue'; import FinalPrompt from '@/components/midjourney/FinalPrompt.vue'; +import { ERROR_CODE_DUPLICATION } from '@/constants/errorCode'; interface IData { channel: IMidjourneyChannel; @@ -147,6 +149,22 @@ export default defineComponent({ this.onFetchApplications(); }, methods: { + onApply() { + applicationOperator + .create({ + // @ts-ignore + application: this.application + }) + .then(({ data: data }: { data: IApplicationDetailResponse }) => { + this.application = data; + ElMessage.success(this.$t('application.message.applySuccessfully')); + }) + .catch((error) => { + if (error?.response?.data?.code === ERROR_CODE_DUPLICATION) { + ElMessage.error(this.$t('application.message.alreadyApplied')); + } + }); + }, async onSelectChannel() { await this.onFetchApplications(); },