feat(bootstrap): refactor runtime dependency management and add lazy loading for binary store and vector index

feat(agent): update import for agent session service
feat(openai): add context truncation check in OpenAI answer generator
docs(README): update frontend environment file conventions
fix(vite): default local frontend development to local backend
This commit is contained in:
ash66
2026-05-25 13:58:48 +08:00
parent 091a02c522
commit 10a034e294
11 changed files with 162 additions and 15 deletions

2
frontend/.env Normal file
View File

@@ -0,0 +1,2 @@
VITE_API_PROXY_TARGET=http://6.86.80.8:8000
FRONTEND_PORT=5173

View File

@@ -0,0 +1,2 @@
VITE_API_PROXY_TARGET=http://127.0.0.1:8000
FRONTEND_PORT=5173

2
frontend/.env.example Normal file
View File

@@ -0,0 +1,2 @@
VITE_API_PROXY_TARGET=http://127.0.0.1:8000
FRONTEND_PORT=5173

View File

@@ -49,6 +49,12 @@ npm run dev
启动本地开发服务器,默认访问 `http://localhost:5173`
前端环境文件约定如下:
- `frontend/.env.development`:本地开发,默认代理到 `http://127.0.0.1:8000`
- `frontend/.env.production`:生产构建,默认代理到 `http://6.86.80.8:8000`
- `frontend/.env.local`:临时覆盖本机配置,优先级高于上面两者
### 构建生产版本
```bash

View File

@@ -1,4 +1,4 @@
import React, { useRef } from 'react';
import React from 'react';
import { useTheme } from '../../contexts';
import type { RetrievalData } from '../../types';

View File

@@ -4,7 +4,8 @@ import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const apiHost = env.API_HOST || '6.86.80.8'
// Default local frontend development to the local backend unless explicitly overridden.
const apiHost = env.API_HOST || '127.0.0.1'
const apiPort = env.API_PORT || '8000'
const proxyTarget = env.VITE_API_PROXY_TARGET || `http://${apiHost}:${apiPort}`