chore: 调整文件结构 service 和 web 分离

This commit is contained in:
ChenZhaoYu 2023-02-13 10:00:08 +08:00
parent 98e75c0c5c
commit f910b5f8a4
16 changed files with 3180 additions and 773 deletions

3
.env
View File

@ -1,5 +1,2 @@
# OpenAI API Key
OPENAI_API_KEY='xxxx'
# Glob API URL
VITE_GLOB_API_URL='http://localhost:3002'

View File

@ -1 +0,0 @@
components.d.ts

View File

@ -1,4 +0,0 @@
{
"semi": false,
"singleQuote": true
}

View File

@ -1,4 +1,6 @@
{
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},

View File

@ -12,7 +12,6 @@
],
"scripts": {
"dev": "vite",
"service": "esno ./service/index.ts",
"build": "run-p type-check build-only",
"preview": "vite preview",
"build-only": "vite build",
@ -27,20 +26,14 @@
"devDependencies": {
"@antfu/eslint-config": "^0.35.2",
"@iconify/vue": "^4.1.0",
"@types/express": "^4.17.17",
"@types/node": "^18.13.0",
"@vitejs/plugin-vue": "^4.0.0",
"autoprefixer": "^10.4.13",
"axios": "^1.3.2",
"bumpp": "^8.2.1",
"chatgpt": "^4.2.0",
"dotenv": "^16.0.3",
"eslint": "^8.34.0",
"esno": "^0.16.3",
"express": "^4.18.2",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.21",
"prettier": "^2.8.4",
"tailwindcss": "^3.2.6",
"typescript": "~4.9.5",
"vite": "^4.1.1",

File diff suppressed because it is too large Load Diff

2
service/.env Normal file
View File

@ -0,0 +1,2 @@
# OpenAI API Key
OPENAI_API_KEY=

4
service/.eslintrc.json Normal file
View File

@ -0,0 +1,4 @@
{
"root": true,
"extends": ["@antfu"]
}

29
service/.gitignore vendored Normal file
View File

@ -0,0 +1,29 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

3
service/.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint"]
}

22
service/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,22 @@
{
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"javascript",
"typescript",
"json",
"jsonc",
"json5",
"yaml"
],
"cSpell.words": [
"antfu",
"chatgpt",
"esno",
"GPTAPI",
"OPENAI"
]
}

33
service/package.json Normal file
View File

@ -0,0 +1,33 @@
{
"name": "chatgpt-web-service",
"version": "1.0.0",
"private": false,
"description": "ChatGPT Web Bot node service",
"keywords": [
"chatgpt",
"chatbot",
"web",
"vue"
],
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"start": "esno ./src/index.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"dependencies": {
"chatgpt": "^4.2.0",
"express": "^4.18.2"
},
"devDependencies": {
"@antfu/eslint-config": "^0.35.2",
"@types/express": "^4.17.17",
"@types/node": "^18.13.0",
"dotenv": "^16.0.3",
"eslint": "^8.34.0",
"esno": "^0.16.3",
"typescript": "^4.9.5"
}
}

3064
service/pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
import dotenv from 'dotenv'
import * as dotenv from 'dotenv'
import { ChatGPTAPI } from 'chatgpt'
interface ChatContext {

View File

@ -1,22 +1,22 @@
{
"compilerOptions": {
"baseUrl": ".",
"module": "ESNext",
"target": "ESNext",
"lib": ["DOM", "ESNext"],
"strict": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"jsx": "preserve",
"moduleResolution": "node",
"resolveJsonModule": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"@/*": ["./src/*"]
},
"types": ["vite/client", "node", "naive-ui/volar"]
},
"exclude": ["node_modules", "dist"]
"compilerOptions": {
"baseUrl": ".",
"module": "ESNext",
"target": "ESNext",
"lib": ["DOM", "ESNext"],
"strict": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"jsx": "preserve",
"moduleResolution": "node",
"resolveJsonModule": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"@/*": ["./src/*"]
},
"types": ["vite/client", "node", "naive-ui/volar"]
},
"exclude": ["node_modules", "dist"]
}