diff --git a/README.md b/README.md
index e76c868b..0bae6587 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
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.
@@ -28,4 +28,4 @@ Run below command to start local server:
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.
diff --git a/deploy/production/deployment.yaml b/deploy/production/deployment.yaml
index 74c292b3..5a961018 100644
--- a/deploy/production/deployment.yaml
+++ b/deploy/production/deployment.yaml
@@ -2,23 +2,23 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
- app: data-frontend
- name: data-frontend
+ app: chat-frontend
+ name: chat-frontend
namespace: zhishuyun
spec:
replicas: 2
revisionHistoryLimit: 5
selector:
matchLabels:
- app: data-frontend
+ app: chat-frontend
template:
metadata:
labels:
- app: data-frontend
+ app: chat-frontend
spec:
containers:
- - image: ghcr.io/zhishuyun/data-frontend:${TAG}
- name: data-frontend
+ - image: ghcr.io/zhishuyun/chat-frontend:${TAG}
+ name: chat-frontend
ports:
- containerPort: 80
livenessProbe:
diff --git a/deploy/production/ingress.yaml b/deploy/production/ingress.yaml
index cbbcca39..f3dfcc33 100644
--- a/deploy/production/ingress.yaml
+++ b/deploy/production/ingress.yaml
@@ -1,7 +1,7 @@
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
- name: data-frontend
+ name: chat-frontend
namespace: zhishuyun
annotations:
kubernetes.io/ingress.class: 'nginx'
@@ -17,6 +17,6 @@ spec:
http:
paths:
- backend:
- serviceName: data-frontend
+ serviceName: chat-frontend
servicePort: 8083
path: /
diff --git a/deploy/production/service.yaml b/deploy/production/service.yaml
index 1bec6f71..bf83b83b 100644
--- a/deploy/production/service.yaml
+++ b/deploy/production/service.yaml
@@ -2,8 +2,8 @@ apiVersion: v1
kind: Service
metadata:
labels:
- app: data-frontend
- name: data-frontend
+ app: chat-frontend
+ name: chat-frontend
namespace: zhishuyun
spec:
ports:
@@ -11,4 +11,4 @@ spec:
port: 8083
targetPort: 80
selector:
- app: data-frontend
+ app: chat-frontend
diff --git a/deploy/test/deployment.yaml b/deploy/test/deployment.yaml
index 3cea1b98..09d00b2a 100644
--- a/deploy/test/deployment.yaml
+++ b/deploy/test/deployment.yaml
@@ -2,23 +2,23 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
- app: data-frontend
- name: data-frontend
+ app: chat-frontend
+ name: chat-frontend
namespace: zhishuyun-test
spec:
replicas: 1
revisionHistoryLimit: 5
selector:
matchLabels:
- app: data-frontend
+ app: chat-frontend
template:
metadata:
labels:
- app: data-frontend
+ app: chat-frontend
spec:
containers:
- - image: ghcr.io/zhishuyun/data-frontend:${TAG}
- name: data-frontend
+ - image: ghcr.io/zhishuyun/chat-frontend:${TAG}
+ name: chat-frontend
ports:
- containerPort: 80
resources:
diff --git a/deploy/test/ingress.yaml b/deploy/test/ingress.yaml
index fdd009f0..64dbc76d 100644
--- a/deploy/test/ingress.yaml
+++ b/deploy/test/ingress.yaml
@@ -1,7 +1,7 @@
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
- name: data-frontend
+ name: chat-frontend
namespace: zhishuyun-test
annotations:
kubernetes.io/ingress.class: 'nginx'
@@ -17,6 +17,6 @@ spec:
http:
paths:
- backend:
- serviceName: data-frontend
+ serviceName: chat-frontend
servicePort: 8083
path: /
diff --git a/deploy/test/service.yaml b/deploy/test/service.yaml
index bc59275f..57f844bd 100644
--- a/deploy/test/service.yaml
+++ b/deploy/test/service.yaml
@@ -2,8 +2,8 @@ apiVersion: v1
kind: Service
metadata:
labels:
- app: data-frontend
- name: data-frontend
+ app: chat-frontend
+ name: chat-frontend
namespace: zhishuyun-test
spec:
ports:
@@ -11,4 +11,4 @@ spec:
port: 8083
targetPort: 80
selector:
- app: data-frontend
+ app: chat-frontend
diff --git a/package.json b/package.json
index b6afae10..e05641dc 100644
--- a/package.json
+++ b/package.json
@@ -11,8 +11,8 @@
"lint": "npx eslint src --fix --ext .ts,.tsx,.vue,.js,.jsx",
"prettier": "npx prettier --write .",
"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: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: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/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": {
"@codemirror/lang-java": "^6.0.1",
diff --git a/src/components/conversation/Message.vue b/src/components/conversation/Message.vue
new file mode 100644
index 00000000..74c23571
--- /dev/null
+++ b/src/components/conversation/Message.vue
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/conversation/MessageContent.vue b/src/components/conversation/MessageContent.vue
new file mode 100644
index 00000000..d56db030
--- /dev/null
+++ b/src/components/conversation/MessageContent.vue
@@ -0,0 +1,30 @@
+
+
+
+
+
diff --git a/src/components/conversation/NewMessageBox.vue b/src/components/conversation/NewMessageBox.vue
new file mode 100644
index 00000000..e9c2f588
--- /dev/null
+++ b/src/components/conversation/NewMessageBox.vue
@@ -0,0 +1,42 @@
+
+
+
+ send
+
+
+
+
+
diff --git a/src/layouts/Console.vue b/src/layouts/Console.vue
index 5a204b77..629527cf 100644
--- a/src/layouts/Console.vue
+++ b/src/layouts/Console.vue
@@ -3,9 +3,6 @@
-
diff --git a/src/layouts/Conversation.vue b/src/layouts/Conversation.vue
new file mode 100644
index 00000000..24299abb
--- /dev/null
+++ b/src/layouts/Conversation.vue
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/operators/api/chatgpt/models.ts b/src/operators/api/chatgpt/models.ts
new file mode 100644
index 00000000..b1fdeea4
--- /dev/null
+++ b/src/operators/api/chatgpt/models.ts
@@ -0,0 +1,10 @@
+export interface IRequest {
+ question: string;
+ stateful?: boolean;
+ conversation_id?: string;
+}
+
+export interface IResponse {
+ answer: string;
+ conversation_id?: string;
+}
diff --git a/src/operators/api/chatgpt/operator.ts b/src/operators/api/chatgpt/operator.ts
new file mode 100644
index 00000000..3a51c0d3
--- /dev/null
+++ b/src/operators/api/chatgpt/operator.ts
@@ -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> {
+ return await httpClient.post(`/chatgpt`, data, {
+ params: query,
+ baseURL: baseUrl
+ });
+ }
+}
+
+export const chatgptOperator = new ChatGPTOperator();
diff --git a/src/operators/message/models.ts b/src/operators/message/models.ts
new file mode 100644
index 00000000..540fd7c1
--- /dev/null
+++ b/src/operators/message/models.ts
@@ -0,0 +1,11 @@
+import { IUser, IBot } from '../user';
+
+export interface IContent {
+ value: string;
+ type?: string;
+}
+
+export interface IMessage {
+ content: IContent;
+ author: IUser | IBot;
+}
diff --git a/src/operators/user/models.ts b/src/operators/user/models.ts
index 6dd5a232..9b9048e0 100644
--- a/src/operators/user/models.ts
+++ b/src/operators/user/models.ts
@@ -10,6 +10,15 @@ export interface IUser {
province?: string;
country?: string;
avatar?: string;
+ type: 'user';
+}
+
+export interface IBot {
+ id?: string;
+ username?: string;
+ nickname?: string;
+ avatar?: string;
+ type: 'bot';
}
export interface IUserDetailResponse extends IUser {}
diff --git a/src/pages/conversation/Detail.vue b/src/pages/conversation/Detail.vue
new file mode 100644
index 00000000..d46756a1
--- /dev/null
+++ b/src/pages/conversation/Detail.vue
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
diff --git a/src/pages/conversation/New.vue b/src/pages/conversation/New.vue
new file mode 100644
index 00000000..be6a5c72
--- /dev/null
+++ b/src/pages/conversation/New.vue
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
diff --git a/src/router/constants.ts b/src/router/constants.ts
index 2b0cc972..8c652889 100644
--- a/src/router/constants.ts
+++ b/src/router/constants.ts
@@ -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_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_DETAIL = 'service-detail';
diff --git a/src/router/conversation.ts b/src/router/conversation.ts
new file mode 100644
index 00000000..983d9d3f
--- /dev/null
+++ b/src/router/conversation.ts
@@ -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')
+ }
+ ]
+};
diff --git a/src/router/index.ts b/src/router/index.ts
index 1df98262..2905c32b 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router';
import service from './service';
import auth from './auth';
import console from './console';
+import conversation from './conversation';
import document from './document';
import store from '@/store';
import { ROUTE_AUTH_LOGIN, ROUTE_INDEX, ROUTE_SERVICE_LIST } from './constants';
@@ -17,7 +18,8 @@ const routes = [
service,
auth,
console,
- document
+ document,
+ conversation
];
const router = createRouter({
diff --git a/src/utils/baseUrl.ts b/src/utils/baseUrl.ts
index 8930f83c..9982854f 100644
--- a/src/utils/baseUrl.ts
+++ b/src/utils/baseUrl.ts
@@ -8,7 +8,7 @@ import { getEnv } from './env';
export const getDataBaseUrl = () => {
const env = getEnv();
if (env === ENV_LOCAL) {
- return 'https://data.local.zhishuyun.com';
+ return 'https://chat.local.zhishuyun.com';
} else if (env === ENV_TEST) {
return 'https://data.test.zhishuyun.com';
} else {
diff --git a/vite.config.ts b/vite.config.ts
index 63be5724..5981c0f7 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -31,11 +31,11 @@ const getDataEndpoint = () => {
export default defineConfig({
server: {
- host: 'data.local.zhishuyun.com',
+ host: 'chat.local.zhishuyun.com',
port: 443,
https: {
- key: fs.readFileSync('certs/data.local.zhishuyun.com.cert.key'),
- cert: fs.readFileSync('certs/data.local.zhishuyun.com.cert.crt')
+ key: fs.readFileSync('certs/chat.local.zhishuyun.com.cert.key'),
+ cert: fs.readFileSync('certs/chat.local.zhishuyun.com.cert.crt')
},
proxy: {
'/api/v1/me': {