feat: 删除多余的内容
This commit is contained in:
parent
d796e10ec6
commit
93f4af22a2
6
.env
6
.env
|
@ -1,3 +1,5 @@
|
|||
OPENAI_API_KEY=''
|
||||
# OpenAI API Key
|
||||
OPENAI_API_KEY='xxxx'
|
||||
|
||||
VITE_GLOB_API_URL='http://192.168.110.170:3002'
|
||||
# Glob API URL
|
||||
VITE_GLOB_API_URL='http://localhost:3002'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "chatgpt-bot",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
@ -12,21 +12,16 @@
|
|||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vueuse/core": "^9.12.0",
|
||||
"dayjs": "^1.11.7",
|
||||
"naive-ui": "^2.34.3",
|
||||
"pinia": "^2.0.28",
|
||||
"vue": "^3.2.45"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^0.35.2",
|
||||
"@iconify/json": "^2.2.19",
|
||||
"@iconify/vue": "^4.1.0",
|
||||
"@types/babel__core": "^7.20.0",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/node": "^18.11.12",
|
||||
"@vitejs/plugin-vue": "^4.0.0",
|
||||
"@vitejs/plugin-vue-jsx": "^3.0.0",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"axios": "^1.3.2",
|
||||
"chatgpt": "^4.2.0",
|
||||
|
@ -34,13 +29,11 @@
|
|||
"eslint": "^8.22.0",
|
||||
"esno": "^0.16.3",
|
||||
"express": "^4.18.2",
|
||||
"less": "^4.1.3",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"postcss": "^8.4.21",
|
||||
"prettier": "^2.7.1",
|
||||
"tailwindcss": "^3.2.6",
|
||||
"typescript": "~4.7.4",
|
||||
"unplugin-icons": "^0.15.2",
|
||||
"vite": "^4.0.0",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vue-tsc": "^1.0.12"
|
||||
|
|
728
pnpm-lock.yaml
728
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,11 @@
|
|||
<script setup lang="ts">
|
||||
import { NConfigProvider, dateZhCN, zhCN } from 'naive-ui'
|
||||
import NaiveProvider from '@/components/NaiveProvider.vue'
|
||||
import { NConfigProvider } from 'naive-ui'
|
||||
import { NaiveProvider } from '@/components'
|
||||
import Chat from '@/views/Chat/index.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NConfigProvider :locale="zhCN" :date-locale="dateZhCN" class="h-full" preflight-style-disabled>
|
||||
<NConfigProvider class="h-full" preflight-style-disabled>
|
||||
<NaiveProvider>
|
||||
<div class="h-full p-4">
|
||||
<Chat />
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
<script setup lang="ts">
|
||||
import { defineComponent, h } from 'vue'
|
||||
import { NDialogProvider, NLoadingBarProvider, NMessageProvider, NNotificationProvider, useDialog, useLoadingBar, useMessage, useNotification } from 'naive-ui'
|
||||
import { NMessageProvider, useMessage } from 'naive-ui'
|
||||
|
||||
function registerNaiveTools() {
|
||||
window.$loadingBar = useLoadingBar()
|
||||
window.$dialog = useDialog()
|
||||
window.$message = useMessage()
|
||||
window.$notification = useNotification()
|
||||
}
|
||||
|
||||
const NaiveProviderContent = defineComponent({
|
||||
|
@ -21,14 +18,8 @@ const NaiveProviderContent = defineComponent({
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<NLoadingBarProvider>
|
||||
<NDialogProvider>
|
||||
<NNotificationProvider>
|
||||
<NMessageProvider>
|
||||
<slot />
|
||||
<NaiveProviderContent />
|
||||
</NMessageProvider>
|
||||
</NNotificationProvider>
|
||||
</NDialogProvider>
|
||||
</NLoadingBarProvider>
|
||||
<NMessageProvider>
|
||||
<slot />
|
||||
<NaiveProviderContent />
|
||||
</NMessageProvider>
|
||||
</template>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import NaiveProvider from './NaiveProvider.vue'
|
||||
import SvgIcon from './SvgIcon.vue'
|
||||
|
||||
export { SvgIcon }
|
||||
export { NaiveProvider, SvgIcon }
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import 'virtual:svg-icons-register'
|
||||
import './styles/css/tailwind.css'
|
||||
import './styles/less/global.less'
|
||||
import './styles/tailwind.css'
|
||||
import './styles/global.css'
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import App from './App.vue'
|
||||
|
||||
function injectMeta() {
|
||||
|
@ -15,7 +14,6 @@ function injectMeta() {
|
|||
function bootstrap() {
|
||||
const app = createApp(App)
|
||||
injectMeta()
|
||||
app.use(createPinia())
|
||||
app.mount('#app')
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
interface Window {
|
||||
$loadingBar?: import('naive-ui').LoadingBarProviderInst;
|
||||
$dialog?: import('naive-ui').DialogProviderInst;
|
||||
$message?: import('naive-ui').MessageProviderInst;
|
||||
$notification?: import('naive-ui').NotificationProviderInst;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ defineProps<Props>()
|
|||
{{ date }}
|
||||
</span>
|
||||
<div class="p-2 mt-2 rounded-md" :class="[user ? 'bg-[#d2f9d1]' : 'bg-[#f4f6f8]']">
|
||||
<span class="leading-relaxed" :class="error ?? 'text-red-500'" v-html="message" />
|
||||
<span class="leading-relaxed" :class="[{ 'text-red-500': error }]" v-html="message" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -96,7 +96,12 @@ function addMessage(message: string, user = false, error = false) {
|
|||
</main>
|
||||
<footer class="p-4">
|
||||
<div class="flex items-center justify-between space-x-2">
|
||||
<NInput v-model:value="value" placeholder="Type a message" :disabled="loading" @keyup="handleEnter" />
|
||||
<NInput
|
||||
v-model:value="value"
|
||||
placeholder="Type a message"
|
||||
:disabled="loading"
|
||||
@keyup="handleEnter"
|
||||
/>
|
||||
<NButton type="primary" :loading="loading" @click="handleSubmit">
|
||||
<SvgIcon icon="ri:send-plane-fill" />
|
||||
</NButton>
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import axios from 'axios'
|
||||
|
||||
async function fetchChatAPI(message: string) {
|
||||
const url = `${import.meta.env.VITE_GLOB_API_URL}/chat`
|
||||
|
||||
if (!message || message.trim() === '')
|
||||
return Promise.reject(new Error('Message is empty'))
|
||||
|
||||
try {
|
||||
const { status, data } = await axios.post(
|
||||
'http://192.168.110.170:3002/chat',
|
||||
url,
|
||||
{ message },
|
||||
)
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import path from 'path'
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
||||
|
||||
export default defineConfig(() => {
|
||||
|
@ -12,7 +11,7 @@ export default defineConfig(() => {
|
|||
'@': path.resolve(process.cwd(), 'src'),
|
||||
},
|
||||
},
|
||||
plugins: [vue(), vueJsx(), createSvgIconsPlugin({
|
||||
plugins: [vue(), createSvgIconsPlugin({
|
||||
iconDirs: [path.resolve(process.cwd(), 'src/icons')],
|
||||
symbolId: 'icon-local-[dir]-[name]',
|
||||
inject: 'body-last',
|
||||
|
|
Loading…
Reference in New Issue