Migrate new service (#1)
This commit is contained in:
1 parent
f13ca37d63
commit
28da0263dc
109 files changed
+1160
-1053
No files matched your search
@@ -50,8 +50,9 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElInput, ElMessage, ElTooltip, ElUpload } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { CHAT_MODEL_CHATGPT4_VISION, IChatModel } from '@/operators';
|
||||
import { IChatModel } from '@/models';
|
||||
import { getBaseUrlData } from '@/utils';
|
||||
import { CHAT_MODEL_GPT_4_VISION } from '@/constants';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'InputBox',
|
||||
@@ -96,7 +97,7 @@ export default defineComponent({
|
||||
return this.fileList.map((file: UploadFile) => file?.response?.file_url);
|
||||
},
|
||||
canUpload() {
|
||||
return [CHAT_MODEL_CHATGPT4_VISION.name].includes(this.model.name);
|
||||
return [CHAT_MODEL_GPT_4_VISION.name].includes(this.model.name);
|
||||
},
|
||||
model(): IChatModel {
|
||||
return this.$store.state.chat.model;
|
||||
|
||||
@@ -73,6 +73,7 @@ import { defineComponent } from 'vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import IntroductionItem from './IntroductionItem.vue';
|
||||
import { ElRow, ElCol } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ConversationIntroduction',
|
||||
components: {
|
||||
|
||||
@@ -33,7 +33,7 @@ import AnsweringMark from './AnsweringMark.vue';
|
||||
import copy from 'copy-to-clipboard';
|
||||
import { ElAlert, ElButton } from 'element-plus';
|
||||
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||
import { IApplication, IChatMessage, IChatMessageState } from '@/operators';
|
||||
import { IApplication, IChatMessage, IChatMessageState } from '@/models';
|
||||
import CopyToClipboard from '../common/CopyToClipboard.vue';
|
||||
import {
|
||||
ERROR_CODE_API_ERROR,
|
||||
@@ -48,6 +48,7 @@ import {
|
||||
} from '@/constants';
|
||||
import message from '@/i18n/zh/common/message';
|
||||
import { ROUTE_CONSOLE_APPLICATION_BUY } from '@/router';
|
||||
|
||||
interface IData {
|
||||
copied: boolean;
|
||||
messageState: typeof IChatMessageState;
|
||||
|
||||
@@ -49,28 +49,27 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElDropdown, ElButton, ElDropdownItem } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { IChatModel } from '@/models';
|
||||
import {
|
||||
CHAT_MODEL_CHATGPT,
|
||||
CHAT_MODEL_CHATGPT4,
|
||||
CHAT_MODEL_CHATGPT4_BROWSING,
|
||||
CHAT_MODEL_CHATGPT4_VISION,
|
||||
CHAT_MODEL_CHATGPT_16K,
|
||||
CHAT_MODEL_CHATGPT_BROWSING
|
||||
} from '@/operators/chat/constants';
|
||||
import { IChatModel } from '@/operators';
|
||||
CHAT_MODEL_GPT_3_5,
|
||||
CHAT_MODEL_GPT_3_5_BROWSING,
|
||||
CHAT_MODEL_GPT_4,
|
||||
CHAT_MODEL_GPT_4_BROWSING,
|
||||
CHAT_MODEL_GPT_4_VISION
|
||||
} from '@/constants';
|
||||
|
||||
const GROUPS = [
|
||||
{
|
||||
label: '3.5',
|
||||
value: 'base',
|
||||
icon: 'fa-solid fa-bolt',
|
||||
options: [CHAT_MODEL_CHATGPT, CHAT_MODEL_CHATGPT_16K, CHAT_MODEL_CHATGPT_BROWSING]
|
||||
options: [CHAT_MODEL_GPT_3_5, CHAT_MODEL_GPT_3_5_BROWSING]
|
||||
},
|
||||
{
|
||||
label: '4.0',
|
||||
value: 'plus',
|
||||
icon: 'fa-solid fa-wand-magic-sparkles',
|
||||
options: [CHAT_MODEL_CHATGPT4, CHAT_MODEL_CHATGPT4_BROWSING, CHAT_MODEL_CHATGPT4_VISION]
|
||||
options: [CHAT_MODEL_GPT_4, CHAT_MODEL_GPT_4_BROWSING, CHAT_MODEL_GPT_4_VISION]
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ import { ElSkeleton, ElInput } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { ROUTE_CHAT_CONVERSATION, ROUTE_CHAT_CONVERSATION_NEW } from '@/router/constants';
|
||||
import { chatOperator } from '@/operators';
|
||||
import { IChatConversation } from '@/operators/chat/models';
|
||||
import { Status } from '@/store/common/models';
|
||||
import { IChatConversation } from '@/models';
|
||||
import { Status } from '@/models';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'SidePanel',
|
||||
@@ -89,11 +89,14 @@ export default defineComponent({
|
||||
conversations() {
|
||||
return this.$store.state.chat.conversations;
|
||||
},
|
||||
applications() {
|
||||
return this.$store.state.chat.applications;
|
||||
application() {
|
||||
return this.$store.state.chat.application;
|
||||
},
|
||||
loading() {
|
||||
return this.$store.state.chat.getConversationsStatus === Status.Request;
|
||||
return this.$store.state.chat.status.getConversations === Status.Request;
|
||||
},
|
||||
token() {
|
||||
return this.application?.credentials?.[0].token;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -103,11 +106,20 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
async onConfirm(conversation: IChatConversation) {
|
||||
const token = this.token;
|
||||
if (!token) {
|
||||
console.error('Token is not found');
|
||||
return;
|
||||
}
|
||||
if (conversation?.deleting) {
|
||||
await chatOperator.deleteConversation(conversation.id);
|
||||
await chatOperator.deleteConversation(conversation.id, {
|
||||
token
|
||||
});
|
||||
await this.$store.dispatch('chat/getConversations');
|
||||
} else if (conversation?.editing) {
|
||||
await chatOperator.updateConversation(conversation);
|
||||
await chatOperator.updateConversation(conversation, {
|
||||
token
|
||||
});
|
||||
await this.$store.dispatch('chat/getConversations');
|
||||
} else {
|
||||
conversation.editing = true;
|
||||
|
||||
Reference in new issue
Block a user