Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update front_end package.json #12

Merged
merged 5 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions front_end/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
VITE_APP_SERVER_URL = ''
VITE_APP_MODE = 'dev'
VITE_APP_API_HOST=
VITE_APP_API_PREFIX=/api/local_doc_qa
VITE_APP_WEB_PREFIX=/qanything

3 changes: 3 additions & 0 deletions front_end/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VITE_APP_API_HOST=http://localhost
VITE_APP_API_PREFIX=/api/local_doc_qa
VITE_APP_WEB_PREFIX=/qanything
6 changes: 3 additions & 3 deletions front_end/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "ai-demo",
"version": "1.0.0",
"version": "1.0.1",
"tagname": "qanything",
"scripts": {
"dev": "vite",
"test": "vite build --mode test",
"analyzer": "vite build --mode test",
"build": "vite build --mode prod",
"build": "vite build",
"serve": "vite preview --port 5052",
"lint-staged": "lint-staged",
"cdn-test": "bash ./cicdn.sh test",
Expand Down Expand Up @@ -62,7 +62,7 @@
"inquirer": "^8.2.0",
"lint-staged": "^12.0.2",
"prettier": "^2.4.1",
"rollup-plugin-visualizer": "^5.5.2",
"rollup-plugin-visualizer": "^5.12.0",
"rxjs": "^7.4.0",
"sass": "^1.42.1",
"sass-loader": "^12.1.0",
Expand Down
10 changes: 6 additions & 4 deletions front_end/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ function resovePath(paths) {
}

export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());

return {
plugins: [
Components({
Expand Down Expand Up @@ -108,7 +110,7 @@ export default defineConfig(({ mode }) => {
outDir: `dist/qanything`,
},

base: '/qanything/',
base: env.VITE_APP_WEB_PREFIX,
server: {
usePolling: true,
port: 5052,
Expand All @@ -119,10 +121,10 @@ export default defineConfig(({ mode }) => {
},
cors: true,
proxy: {
'/local_doc_qa': {
target: 'http://localhost:8777/api',
[env.VITE_APP_API_PREFIX]: {
target: env.VITE_HOST,
changeOrigin: true,
rewrite: path => path.replace(/^\/local_doc_qa/, '/local_doc_qa'),
secure: false,
},
},
},
Expand Down
6 changes: 5 additions & 1 deletion run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
$content = Get-Content -Raw -Path .\scripts\run_for_local.sh -Encoding utf8
$content = $content -replace "`r$", ""
# 移除 BOM
$contentWithoutBOM = $content -replace '^\xEF\xBB\xBF', ''
$content = $content -replace '^\xef\xbb\xbf', ''
$content = $content -replace '^\xff\xfe', ''
$content = $content -replace '^\xfe\xff', ''
$content = $content -replace '^\xff\xfe\x00\x00', ''
$content = $content -replace '^\x00\x00\xfe\xff', ''
# 移除文件结尾的空白字符并添加一个新行
$content = $content -replace "\s+$", "`n"

Expand Down