Migrate new service (#1)
This commit is contained in:
1 parent
f13ca37d63
commit
28da0263dc
109 files changed
+1160
-1053
No files matched your search
@@ -5,12 +5,12 @@
|
||||
<conversations class="side" />
|
||||
<div class="chat">
|
||||
<div class="status">
|
||||
<api-status
|
||||
<application-status
|
||||
:initializing="initializing"
|
||||
:application="application"
|
||||
:need-apply="needApply"
|
||||
:api-id="apiId"
|
||||
@refresh="$store.dispatch('chatdoc/getApplications')"
|
||||
:service="service"
|
||||
@refresh="$store.dispatch('chatdoc/getApplication')"
|
||||
/>
|
||||
</div>
|
||||
<div class="dialogue">
|
||||
@@ -40,14 +40,7 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import Layout from '@/layouts/Chatdoc.vue';
|
||||
import {
|
||||
IApplication,
|
||||
IChatdocChatResponse,
|
||||
IChatdocConversation,
|
||||
IChatdocMessageState,
|
||||
IChatdocRepository,
|
||||
chatdocOperator
|
||||
} from '@/operators';
|
||||
import { chatdocOperator } from '@/operators';
|
||||
import Conversations from '@/components/chatdoc/Conversations.vue';
|
||||
import Message from '@/components/chatdoc/Message.vue';
|
||||
import InputBox from '@/components/chatdoc/InputBox.vue';
|
||||
@@ -58,13 +51,13 @@ import {
|
||||
ROLE_ASSISTANT,
|
||||
ROLE_USER
|
||||
} from '@/constants';
|
||||
import { API_ID_CHATDOC_CHAT } from '@/operators/chatdoc/constants';
|
||||
import { log } from '@/utils';
|
||||
import { ROUTE_CHATDOC_CONVERSATION } from '@/router';
|
||||
import axios from 'axios';
|
||||
import { isJSONString } from '@/utils/is';
|
||||
import { Status } from '@/store/common/models';
|
||||
import ApiStatus from '@/components/common/ApiStatus.vue';
|
||||
import { Status } from '@/models';
|
||||
import ApplicationStatus from '@/components/application/Status.vue';
|
||||
import { IChatdocChatResponse, IChatdocConversation, IChatdocMessageState, IChatdocRepository } from '@/models';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ChatdocChat',
|
||||
@@ -73,7 +66,7 @@ export default defineComponent({
|
||||
Conversations,
|
||||
Message,
|
||||
InputBox,
|
||||
ApiStatus
|
||||
ApplicationStatus
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -81,7 +74,6 @@ export default defineComponent({
|
||||
repositoryId: this.$route.params.repositoryId.toString(),
|
||||
answering: false,
|
||||
question: ''
|
||||
// references: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -107,19 +99,16 @@ export default defineComponent({
|
||||
return this.$route.params.conversationId?.toString();
|
||||
},
|
||||
application() {
|
||||
return this.applications?.find((application: IApplication) => application.api?.id === API_ID_CHATDOC_CHAT);
|
||||
},
|
||||
applications() {
|
||||
return this.$store.state.chatdoc.applications;
|
||||
return this.$store.state.chatdoc.application;
|
||||
},
|
||||
needApply() {
|
||||
return this.$store.state.chatdoc.getApplicationsStatus === Status.Success && !this.application;
|
||||
return this.$store.state.chatdoc.status.getApplication === Status.Success && !this.application;
|
||||
},
|
||||
initializing() {
|
||||
return this.$store.state.chatdoc.getApplicationsStatus === Status.Request;
|
||||
return this.$store.state.chatdoc.status.getApplication === Status.Request;
|
||||
},
|
||||
apiId() {
|
||||
return API_ID_CHATDOC_CHAT;
|
||||
service() {
|
||||
return this.$store.state.chatdoc.service;
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
@@ -153,14 +142,12 @@ export default defineComponent({
|
||||
}, 0);
|
||||
},
|
||||
async onFetchAnswer() {
|
||||
const token = this.application?.credential?.token;
|
||||
const endpoint = this.application?.api?.endpoint;
|
||||
const path = this.application?.api?.path;
|
||||
const token = this.application?.credentials?.[0]?.token;
|
||||
const question = this.question;
|
||||
log(this.onFetchAnswer, 'validated', question);
|
||||
// reset question and references
|
||||
this.question = '';
|
||||
if (!token || !endpoint || !question || !path) {
|
||||
if (!token || !question) {
|
||||
console.error('no token or endpoint or question');
|
||||
this.messages.push({
|
||||
error: {
|
||||
|
||||
+13
-19
@@ -9,12 +9,12 @@
|
||||
{{ $t('chatdoc.message.introductionForRepository') }}
|
||||
</div>
|
||||
<div class="status">
|
||||
<api-status
|
||||
<application-status
|
||||
:initializing="initializing"
|
||||
:application="application"
|
||||
:need-apply="needApply"
|
||||
:api-id="apiId"
|
||||
@refresh="$store.dispatch('chatdoc/getApplications')"
|
||||
:service="service"
|
||||
@refresh="$store.dispatch('chatdoc/getApplication')"
|
||||
/>
|
||||
</div>
|
||||
<el-row class="repositories" :gutter="15">
|
||||
@@ -63,13 +63,12 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import Layout from '@/layouts/Chatdoc.vue';
|
||||
import { ElCard, ElRow, ElCol, ElDropdown, ElDropdownItem, ElDropdownMenu, ElMessage } from 'element-plus';
|
||||
import { IApplication, IChatdocRepository } from '@/operators';
|
||||
import { IChatdocRepository } from '@/models';
|
||||
import { ROUTE_CHATDOC_MANAGE } from '@/router';
|
||||
import CreateRepository from '@/components/chatdoc/CreateRepository.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import ApiStatus from '@/components/common/ApiStatus.vue';
|
||||
import { Status } from '@/store/common/models';
|
||||
import { API_ID_CHATDOC_REPOSITORIES } from '@/operators/chatdoc/constants';
|
||||
import ApplicationStatus from '@/components/application/Status.vue';
|
||||
import { Status } from '@/models';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ChatdocKnowledge',
|
||||
@@ -83,31 +82,26 @@ export default defineComponent({
|
||||
ElDropdown,
|
||||
ElDropdownItem,
|
||||
ElDropdownMenu,
|
||||
ApiStatus
|
||||
ApplicationStatus
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
apiId() {
|
||||
return API_ID_CHATDOC_REPOSITORIES;
|
||||
},
|
||||
repositories() {
|
||||
return this.$store.state.chatdoc.repositories;
|
||||
},
|
||||
needApply() {
|
||||
return this.$store.state.chatdoc.getApplicationsStatus === Status.Success && !this.application;
|
||||
},
|
||||
applications() {
|
||||
return this.$store.state.chatdoc.applications;
|
||||
return this.$store.state.chatdoc.status.getApplication === Status.Success && !this.application;
|
||||
},
|
||||
application() {
|
||||
return this.applications?.find(
|
||||
(application: IApplication) => application.api?.id === API_ID_CHATDOC_REPOSITORIES
|
||||
);
|
||||
return this.$store.state.chatdoc.application;
|
||||
},
|
||||
service() {
|
||||
return this.$store.state.chatdoc.service;
|
||||
},
|
||||
initializing() {
|
||||
return this.$store.state.chatdoc.getApplicationsStatus === Status.Request;
|
||||
return this.$store.state.chatdoc.status.getApplication === Status.Request;
|
||||
}
|
||||
},
|
||||
async mounted() {},
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
{{ $t('chatdoc.message.introductionForKnowledge') }}
|
||||
</div>
|
||||
<div class="status">
|
||||
<api-status
|
||||
<application-status
|
||||
:initializing="initializing"
|
||||
:application="application"
|
||||
:need-apply="needApply"
|
||||
:api-id="apiId"
|
||||
@refresh="$store.dispatch('chatdoc/getApplications')"
|
||||
:service="service"
|
||||
@refresh="$store.dispatch('chatdoc/getApplication')"
|
||||
/>
|
||||
</div>
|
||||
<div class="operations">
|
||||
@@ -64,12 +64,11 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import Layout from '@/layouts/Chatdoc.vue';
|
||||
import { IApplication, IChatdocRepository } from '@/operators';
|
||||
import { IApplication, IChatdocRepository } from '@/models';
|
||||
import { ElButton, ElTag, ElTable, ElTableColumn, ElMessage } from 'element-plus';
|
||||
import UploadDocument from '@/components/chatdoc/UploadDocument.vue';
|
||||
import { Status } from '@/store/common/models';
|
||||
import { API_ID_CHATDOC_DOCUMENTS } from '@/operators/chatdoc/constants';
|
||||
import ApiStatus from '@/components/common/ApiStatus.vue';
|
||||
import { Status } from '@/models';
|
||||
import ApplicationStatus from '@/components/application/Status.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ChatdocKnowledge',
|
||||
@@ -78,7 +77,7 @@ export default defineComponent({
|
||||
ElButton,
|
||||
ElTable,
|
||||
ElTag,
|
||||
ApiStatus,
|
||||
ApplicationStatus,
|
||||
ElTableColumn,
|
||||
UploadDocument
|
||||
},
|
||||
@@ -96,19 +95,16 @@ export default defineComponent({
|
||||
return this.repository?.documents;
|
||||
},
|
||||
needApply() {
|
||||
return this.$store.state.chatdoc.getApplicationsStatus === Status.Success && !this.application;
|
||||
return this.$store.state.chatdoc.status.getApplication === Status.Success && !this.application;
|
||||
},
|
||||
applications() {
|
||||
return this.$store.state.chatdoc.applications;
|
||||
service() {
|
||||
return this.$store.state.chatdoc.service;
|
||||
},
|
||||
application() {
|
||||
return this.applications?.find((application: IApplication) => application.api?.id === API_ID_CHATDOC_DOCUMENTS);
|
||||
return this.$store.state.chatdoc.application;
|
||||
},
|
||||
initializing() {
|
||||
return this.$store.state.chatdoc.getApplicationsStatus === Status.Request;
|
||||
},
|
||||
apiId() {
|
||||
return API_ID_CHATDOC_DOCUMENTS;
|
||||
return this.$store.state.chatdoc.status.getApplication === Status.Request;
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
|
||||
Reference in new issue
Block a user