pref: 优化部份内容
This commit is contained in:
parent
93f4af22a2
commit
36eff8af07
19
README.md
19
README.md
|
@ -1,2 +1,21 @@
|
||||||
# ChatGPT Bot Web
|
# ChatGPT Bot Web
|
||||||
|
|
||||||
|
This is a ChatGPT web application demo with express and vue3
|
||||||
|
|
||||||
|
![cover](./docs/cover.png)
|
||||||
|
## Intro
|
||||||
|
1. `node >= 18`
|
||||||
|
1. `pnpm install` node deps
|
||||||
|
2. set `OPENAI_API_KEY` in `.env`
|
||||||
|
|
||||||
|
## Run
|
||||||
|
```shell
|
||||||
|
# 1. run service
|
||||||
|
pnpm run service
|
||||||
|
|
||||||
|
# 2. run web
|
||||||
|
pnpm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
MIT © [ChenZhaoYu](./license)
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 ChenZhaoYu
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
10
package.json
10
package.json
|
@ -1,7 +1,15 @@
|
||||||
{
|
{
|
||||||
"name": "chatgpt-bot",
|
"name": "chatgpt-bot",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"description": "ChatGPT Web Bot",
|
||||||
|
"author": "ChenZhaoYu <chenzhaoyu1994@gami.com>",
|
||||||
|
"private": false,
|
||||||
|
"keywords": [
|
||||||
|
"chatgpt",
|
||||||
|
"chatbot",
|
||||||
|
"web",
|
||||||
|
"vue"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"service": "esno ./service/index.ts",
|
"service": "esno ./service/index.ts",
|
||||||
|
|
12
src/App.vue
12
src/App.vue
|
@ -7,9 +7,19 @@ import Chat from '@/views/Chat/index.vue'
|
||||||
<template>
|
<template>
|
||||||
<NConfigProvider class="h-full" preflight-style-disabled>
|
<NConfigProvider class="h-full" preflight-style-disabled>
|
||||||
<NaiveProvider>
|
<NaiveProvider>
|
||||||
<div class="h-full p-4">
|
<div class="flex flex-col h-full p-4">
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="container h-full m-auto">
|
||||||
<Chat />
|
<Chat />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="px-4 mt-4 text-sm text-center text-neutral-500">
|
||||||
|
Made By ChenZhaoYu
|
||||||
|
<a href="https://github.com/Chanzhaoyu/chatgpt-bot" target="_blank" class="text-blue-500">
|
||||||
|
Github
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</NaiveProvider>
|
</NaiveProvider>
|
||||||
</NConfigProvider>
|
</NConfigProvider>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
/** api url */
|
/** api url */
|
||||||
readonly VITE_GLOB_API_URL: string;
|
readonly VITE_GLOB_API_URL: string;
|
||||||
|
|
|
@ -74,7 +74,9 @@ function addMessage(message: string, user = false, error = false) {
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col h-full overflow-hidden border rounded-md shadow-md">
|
<div class="flex flex-col h-full overflow-hidden border rounded-md shadow-md">
|
||||||
<header class="flex items-center justify-between p-4">
|
<header class="flex items-center justify-between p-4">
|
||||||
<div>会话</div>
|
<h1 class="text-xl font-bold">
|
||||||
|
Chat
|
||||||
|
</h1>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
class="w-[40px] h-[40px] rounded-full hover:bg-neutral-100 transition flex justify-center items-center"
|
class="w-[40px] h-[40px] rounded-full hover:bg-neutral-100 transition flex justify-center items-center"
|
||||||
|
@ -103,7 +105,9 @@ function addMessage(message: string, user = false, error = false) {
|
||||||
@keyup="handleEnter"
|
@keyup="handleEnter"
|
||||||
/>
|
/>
|
||||||
<NButton type="primary" :loading="loading" @click="handleSubmit">
|
<NButton type="primary" :loading="loading" @click="handleSubmit">
|
||||||
|
<template #icon>
|
||||||
<SvgIcon icon="ri:send-plane-fill" />
|
<SvgIcon icon="ri:send-plane-fill" />
|
||||||
|
</template>
|
||||||
</NButton>
|
</NButton>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
Loading…
Reference in New Issue