chatgpt ui
This commit is contained in:
1 parent
523ab178a4
commit
ed43ab5afd
24 files changed
+495
-34
No files matched your search
@@ -5,7 +5,7 @@
|
|||||||
Modify the host file, like `/etc/hosts`, add this line:
|
Modify the host file, like `/etc/hosts`, add this line:
|
||||||
|
|
||||||
```
|
```
|
||||||
127.0.0.1 data.local.zhishuyun.com
|
127.0.0.1 chat.local.zhishuyun.com
|
||||||
```
|
```
|
||||||
|
|
||||||
Then save it.
|
Then save it.
|
||||||
@@ -28,4 +28,4 @@ Run below command to start local server:
|
|||||||
sudo yarn start
|
sudo yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
Then open `https://data.local.zhishuyun.com` to view the content.
|
Then open `https://chat.local.zhishuyun.com` to view the content.
|
||||||
@@ -2,23 +2,23 @@ apiVersion: apps/v1
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: data-frontend
|
app: chat-frontend
|
||||||
name: data-frontend
|
name: chat-frontend
|
||||||
namespace: zhishuyun
|
namespace: zhishuyun
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
revisionHistoryLimit: 5
|
revisionHistoryLimit: 5
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: data-frontend
|
app: chat-frontend
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: data-frontend
|
app: chat-frontend
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: ghcr.io/zhishuyun/data-frontend:${TAG}
|
- image: ghcr.io/zhishuyun/chat-frontend:${TAG}
|
||||||
name: data-frontend
|
name: chat-frontend
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
apiVersion: networking.k8s.io/v1beta1
|
apiVersion: networking.k8s.io/v1beta1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: data-frontend
|
name: chat-frontend
|
||||||
namespace: zhishuyun
|
namespace: zhishuyun
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: 'nginx'
|
kubernetes.io/ingress.class: 'nginx'
|
||||||
@@ -17,6 +17,6 @@ spec:
|
|||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- backend:
|
||||||
serviceName: data-frontend
|
serviceName: chat-frontend
|
||||||
servicePort: 8083
|
servicePort: 8083
|
||||||
path: /
|
path: /
|
||||||
@@ -2,8 +2,8 @@ apiVersion: v1
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: data-frontend
|
app: chat-frontend
|
||||||
name: data-frontend
|
name: chat-frontend
|
||||||
namespace: zhishuyun
|
namespace: zhishuyun
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
@@ -11,4 +11,4 @@ spec:
|
|||||||
port: 8083
|
port: 8083
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
app: data-frontend
|
app: chat-frontend
|
||||||
@@ -2,23 +2,23 @@ apiVersion: apps/v1
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: data-frontend
|
app: chat-frontend
|
||||||
name: data-frontend
|
name: chat-frontend
|
||||||
namespace: zhishuyun-test
|
namespace: zhishuyun-test
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
revisionHistoryLimit: 5
|
revisionHistoryLimit: 5
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: data-frontend
|
app: chat-frontend
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: data-frontend
|
app: chat-frontend
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: ghcr.io/zhishuyun/data-frontend:${TAG}
|
- image: ghcr.io/zhishuyun/chat-frontend:${TAG}
|
||||||
name: data-frontend
|
name: chat-frontend
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
apiVersion: networking.k8s.io/v1beta1
|
apiVersion: networking.k8s.io/v1beta1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: data-frontend
|
name: chat-frontend
|
||||||
namespace: zhishuyun-test
|
namespace: zhishuyun-test
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: 'nginx'
|
kubernetes.io/ingress.class: 'nginx'
|
||||||
@@ -17,6 +17,6 @@ spec:
|
|||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- backend:
|
||||||
serviceName: data-frontend
|
serviceName: chat-frontend
|
||||||
servicePort: 8083
|
servicePort: 8083
|
||||||
path: /
|
path: /
|
||||||
@@ -2,8 +2,8 @@ apiVersion: v1
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: data-frontend
|
app: chat-frontend
|
||||||
name: data-frontend
|
name: chat-frontend
|
||||||
namespace: zhishuyun-test
|
namespace: zhishuyun-test
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
@@ -11,4 +11,4 @@ spec:
|
|||||||
port: 8083
|
port: 8083
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
app: data-frontend
|
app: chat-frontend
|
||||||
+2
-2
@@ -11,8 +11,8 @@
|
|||||||
"lint": "npx eslint src --fix --ext .ts,.tsx,.vue,.js,.jsx",
|
"lint": "npx eslint src --fix --ext .ts,.tsx,.vue,.js,.jsx",
|
||||||
"prettier": "npx prettier --write .",
|
"prettier": "npx prettier --write .",
|
||||||
"init:https": "npm run init:ca && npm run init:cert",
|
"init:https": "npm run init:ca && npm run init:cert",
|
||||||
"init:ca": "npx mkcert create-ca --validity 36500 --key certs/data.local.zhishuyun.com.ca.key --cert certs/data.local.zhishuyun.com.ca.crt",
|
"init:ca": "npx mkcert create-ca --validity 36500 --key certs/chat.local.zhishuyun.com.ca.key --cert certs/chat.local.zhishuyun.com.ca.crt",
|
||||||
"init:cert": "npx mkcert create-cert --ca-key certs/data.local.zhishuyun.com.ca.key --ca-cert certs/data.local.zhishuyun.com.ca.crt --validity 36500 --key certs/data.local.zhishuyun.com.cert.key --cert certs/data.local.zhishuyun.com.cert.crt --domains data.local.zhishuyun.com"
|
"init:cert": "npx mkcert create-cert --ca-key certs/chat.local.zhishuyun.com.ca.key --ca-cert certs/chat.local.zhishuyun.com.ca.crt --validity 36500 --key certs/chat.local.zhishuyun.com.cert.key --cert certs/chat.local.zhishuyun.com.cert.crt --domains chat.local.zhishuyun.com"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/lang-java": "^6.0.1",
|
"@codemirror/lang-java": "^6.0.1",
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<template>
|
||||||
|
<div class="message">
|
||||||
|
<el-image :src="author.avatar" class="icon" />
|
||||||
|
<message-content :content="content" class="content" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { IBot, IUser } from '@/operators';
|
||||||
|
import { IContent } from '@/operators/message/models';
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
import MessageContent from './MessageContent.vue';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'Message',
|
||||||
|
components: {
|
||||||
|
MessageContent
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
content: {
|
||||||
|
type: Object as () => IContent,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
author: {
|
||||||
|
type: Object as () => IUser | IBot,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
conversationId() {
|
||||||
|
return this.$route.params?.id?.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.message {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
.icon {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<template>
|
||||||
|
<markdown-renderer :content="content.value" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { IContent } from '@/operators/message/models';
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'MessageContent',
|
||||||
|
components: {
|
||||||
|
MarkdownRenderer
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
content: {
|
||||||
|
type: Object as () => IContent,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
conversationId() {
|
||||||
|
return this.$route.params?.id?.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<template>
|
||||||
|
<el-input v-model="value" placeholder="Type something">
|
||||||
|
<template #suffix>
|
||||||
|
<el-icon class="el-input__icon" @click="$emit('send')">send</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
import { ElInput, ElButton, ElIcon } from 'element-plus';
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'NewMessageBox',
|
||||||
|
components: {
|
||||||
|
ElInput,
|
||||||
|
ElIcon
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
modelValue: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
emits: ['send', 'update:modelValue'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
value: this.modelValue
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
conversationId() {
|
||||||
|
return this.$route.params?.id?.toString();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(val) {
|
||||||
|
console.log('ccc', this.value);
|
||||||
|
this.$emit('update:modelValue', this.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -3,9 +3,6 @@
|
|||||||
<el-aside class="aside">
|
<el-aside class="aside">
|
||||||
<navigator />
|
<navigator />
|
||||||
</el-aside>
|
</el-aside>
|
||||||
<el-header class="header">
|
|
||||||
<navigator />
|
|
||||||
</el-header>
|
|
||||||
<el-main class="main"> <router-view /> </el-main>
|
<el-main class="main"> <router-view /> </el-main>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<template>
|
||||||
|
<div class="container">
|
||||||
|
<el-main class="main"> <router-view /> </el-main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
import { ElMain, ElAside } from 'element-plus';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'LayoutConversation',
|
||||||
|
components: {
|
||||||
|
ElMain
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100%;
|
||||||
|
max-width: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$width: 300px;
|
||||||
|
.aside {
|
||||||
|
width: $width;
|
||||||
|
height: 100%;
|
||||||
|
background-color: white;
|
||||||
|
padding: 15px;
|
||||||
|
padding-top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
width: calc(100% - $width);
|
||||||
|
background-color: #f3f5f6;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 800px) {
|
||||||
|
.container {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.aside {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
display: block;
|
||||||
|
background: white;
|
||||||
|
padding: 15px;
|
||||||
|
padding-top: 50px;
|
||||||
|
height: fit-content;
|
||||||
|
overflow: hidden;
|
||||||
|
.logo {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.main {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
export interface IRequest {
|
||||||
|
question: string;
|
||||||
|
stateful?: boolean;
|
||||||
|
conversation_id?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IResponse {
|
||||||
|
answer: string;
|
||||||
|
conversation_id?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { AxiosResponse } from 'axios';
|
||||||
|
import { httpClient } from '../../instance';
|
||||||
|
import { IRequest, IResponse } from './models';
|
||||||
|
|
||||||
|
export interface IQuery {
|
||||||
|
token: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseUrl = 'https://api.zhishuyun.com';
|
||||||
|
|
||||||
|
class ChatGPTOperator {
|
||||||
|
async post(data: IRequest, query: IQuery): Promise<AxiosResponse<IResponse>> {
|
||||||
|
return await httpClient.post(`/chatgpt`, data, {
|
||||||
|
params: query,
|
||||||
|
baseURL: baseUrl
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const chatgptOperator = new ChatGPTOperator();
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { IUser, IBot } from '../user';
|
||||||
|
|
||||||
|
export interface IContent {
|
||||||
|
value: string;
|
||||||
|
type?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IMessage {
|
||||||
|
content: IContent;
|
||||||
|
author: IUser | IBot;
|
||||||
|
}
|
||||||
@@ -10,6 +10,15 @@ export interface IUser {
|
|||||||
province?: string;
|
province?: string;
|
||||||
country?: string;
|
country?: string;
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
|
type: 'user';
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IBot {
|
||||||
|
id?: string;
|
||||||
|
username?: string;
|
||||||
|
nickname?: string;
|
||||||
|
avatar?: string;
|
||||||
|
type: 'bot';
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IUserDetailResponse extends IUser {}
|
export interface IUserDetailResponse extends IUser {}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
<template>
|
||||||
|
<div class="conversation">
|
||||||
|
<div class="messages">
|
||||||
|
<div
|
||||||
|
v-for="(message, messageIndex) in messages"
|
||||||
|
:key="messageIndex"
|
||||||
|
:class="{
|
||||||
|
'message-wrapper': true,
|
||||||
|
user: message.author.type === 'user',
|
||||||
|
bot: message.author.type === 'bot'
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="18" :offset="3">
|
||||||
|
<message :content="message.content" :author="message.author"> </message>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="footer">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="18" :offset="3">
|
||||||
|
<new-message-box v-model="input" class="new-message" @send="onSend" />
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { IMessage } from '@/operators/message/models';
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
import { ElRow, ElCol } from 'element-plus';
|
||||||
|
import Message from '@/components/conversation/Message.vue';
|
||||||
|
import { chatgptOperator } from '@/operators/api/chatgpt/operator';
|
||||||
|
import { IResponse } from '@/operators/api/chatgpt/models';
|
||||||
|
import NewMessageBox from '@/components/conversation/NewMessageBox.vue';
|
||||||
|
|
||||||
|
export interface IData {
|
||||||
|
input: string;
|
||||||
|
messages: IMessage[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'ChatDetail',
|
||||||
|
components: {
|
||||||
|
Message,
|
||||||
|
ElRow,
|
||||||
|
ElCol,
|
||||||
|
NewMessageBox
|
||||||
|
},
|
||||||
|
data(): IData {
|
||||||
|
return {
|
||||||
|
input: '',
|
||||||
|
messages: [
|
||||||
|
{
|
||||||
|
author: {
|
||||||
|
type: 'bot',
|
||||||
|
nickname: 'ChatGPT'
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
value: '你好啊'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
author: {
|
||||||
|
id: 'x',
|
||||||
|
type: 'user',
|
||||||
|
nickname: 'fdsf'
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
value: '很高兴为你服务'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
conversationId() {
|
||||||
|
return this.$route.params?.id?.toString();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onSend() {
|
||||||
|
console.log('send', this.input);
|
||||||
|
chatgptOperator
|
||||||
|
.post(
|
||||||
|
{
|
||||||
|
question: this.input
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: 'ec5cc681720b4923b05f669a853c5629'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(({ data: data }: { data: IResponse }) => {
|
||||||
|
console.log('data', data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.conversation {
|
||||||
|
min-height: 100vh;
|
||||||
|
flex-direction: column;
|
||||||
|
display: flex;
|
||||||
|
.messages {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.message-wrapper {
|
||||||
|
border-color: rgba(0, 0, 0, 0.1);
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
padding-bottom: 1.5rem;
|
||||||
|
padding-top: 1.5rem;
|
||||||
|
&.bot {
|
||||||
|
background-color: #f7f7f8;
|
||||||
|
}
|
||||||
|
&.user {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.new-message {
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<template>
|
||||||
|
<div class="conversation">
|
||||||
|
<div class="introduction"></div>
|
||||||
|
<div class="footer">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="18" :offset="3">
|
||||||
|
<new-message-box v-model="input" class="new-message" @send="onSend" />
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
import { ElRow, ElCol } from 'element-plus';
|
||||||
|
import NewMessageBox from '@/components/conversation/NewMessageBox.vue';
|
||||||
|
import { chatgptOperator } from '@/operators/api/chatgpt/operator';
|
||||||
|
import { IResponse } from '@/operators/api/chatgpt/models';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'ChatMain',
|
||||||
|
components: {
|
||||||
|
NewMessageBox,
|
||||||
|
ElRow,
|
||||||
|
ElCol
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
input: ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
methods: {
|
||||||
|
onSend() {
|
||||||
|
console.log('send', this.input);
|
||||||
|
chatgptOperator
|
||||||
|
.post(
|
||||||
|
{
|
||||||
|
question: this.input
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token: 'ec5cc681720b4923b05f669a853c5629'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(({ data: data }: { data: IResponse }) => {
|
||||||
|
console.log('data', data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.conversation {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 100vh;
|
||||||
|
|
||||||
|
.introduction {
|
||||||
|
flex-grow: 1;
|
||||||
|
flex-shrink: 1;
|
||||||
|
flex-basis: 0%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -12,6 +12,8 @@ export const ROUTE_CONSOLE_ADMIN_APPLICATION = 'console-application-admin-applic
|
|||||||
|
|
||||||
export const ROUTE_DOCUMENT_LIST = 'document-list';
|
export const ROUTE_DOCUMENT_LIST = 'document-list';
|
||||||
export const ROUTE_DOCUMENT_DETAIL = 'document-detail';
|
export const ROUTE_DOCUMENT_DETAIL = 'document-detail';
|
||||||
|
export const ROUTE_CONVERSATION_NEW = 'conversation-new';
|
||||||
|
export const ROUTE_CONVERSATION_DETAIL = 'conversation-detail';
|
||||||
|
|
||||||
export const ROUTE_SERVICE_LIST = 'service-list';
|
export const ROUTE_SERVICE_LIST = 'service-list';
|
||||||
export const ROUTE_SERVICE_DETAIL = 'service-detail';
|
export const ROUTE_SERVICE_DETAIL = 'service-detail';
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { ROUTE_CONVERSATION_DETAIL, ROUTE_CONVERSATION_NEW, ROUTE_DOCUMENT_LIST } from './constants';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
path: '/conversations',
|
||||||
|
component: () => import('@/layouts/Conversation.vue'),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
name: ROUTE_CONVERSATION_NEW,
|
||||||
|
component: () => import('@/pages/conversation/New.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ':id',
|
||||||
|
name: ROUTE_CONVERSATION_DETAIL,
|
||||||
|
component: () => import('@/pages/conversation/Detail.vue')
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
+3
-1
@@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router';
|
|||||||
import service from './service';
|
import service from './service';
|
||||||
import auth from './auth';
|
import auth from './auth';
|
||||||
import console from './console';
|
import console from './console';
|
||||||
|
import conversation from './conversation';
|
||||||
import document from './document';
|
import document from './document';
|
||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
import { ROUTE_AUTH_LOGIN, ROUTE_INDEX, ROUTE_SERVICE_LIST } from './constants';
|
import { ROUTE_AUTH_LOGIN, ROUTE_INDEX, ROUTE_SERVICE_LIST } from './constants';
|
||||||
@@ -17,7 +18,8 @@ const routes = [
|
|||||||
service,
|
service,
|
||||||
auth,
|
auth,
|
||||||
console,
|
console,
|
||||||
document
|
document,
|
||||||
|
conversation
|
||||||
];
|
];
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { getEnv } from './env';
|
|||||||
export const getDataBaseUrl = () => {
|
export const getDataBaseUrl = () => {
|
||||||
const env = getEnv();
|
const env = getEnv();
|
||||||
if (env === ENV_LOCAL) {
|
if (env === ENV_LOCAL) {
|
||||||
return 'https://data.local.zhishuyun.com';
|
return 'https://chat.local.zhishuyun.com';
|
||||||
} else if (env === ENV_TEST) {
|
} else if (env === ENV_TEST) {
|
||||||
return 'https://data.test.zhishuyun.com';
|
return 'https://data.test.zhishuyun.com';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+3
-3
@@ -31,11 +31,11 @@ const getDataEndpoint = () => {
|
|||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
server: {
|
server: {
|
||||||
host: 'data.local.zhishuyun.com',
|
host: 'chat.local.zhishuyun.com',
|
||||||
port: 443,
|
port: 443,
|
||||||
https: {
|
https: {
|
||||||
key: fs.readFileSync('certs/data.local.zhishuyun.com.cert.key'),
|
key: fs.readFileSync('certs/chat.local.zhishuyun.com.cert.key'),
|
||||||
cert: fs.readFileSync('certs/data.local.zhishuyun.com.cert.crt')
|
cert: fs.readFileSync('certs/chat.local.zhishuyun.com.cert.crt')
|
||||||
},
|
},
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api/v1/me': {
|
'/api/v1/me': {
|
||||||
|
|||||||
Reference in new issue
Block a user