Commit 2a76641e492929c1c69a6eeeeafe3abceec2257e
1 parent
115047ee
config
Showing
16 changed files
with
67 additions
and
61 deletions
Show diff stats
| @@ -19,7 +19,7 @@ CUSTOMER_ID=customer1 | @@ -19,7 +19,7 @@ CUSTOMER_ID=customer1 | ||
| 19 | 19 | ||
| 20 | # API Service Configuration | 20 | # API Service Configuration |
| 21 | API_HOST=0.0.0.0 | 21 | API_HOST=0.0.0.0 |
| 22 | -API_PORT=8000 | 22 | +API_PORT=6002 |
| 23 | 23 | ||
| 24 | # Embedding Models | 24 | # Embedding Models |
| 25 | TEXT_MODEL_DIR=/data/tw/models/bge-m3 | 25 | TEXT_MODEL_DIR=/data/tw/models/bge-m3 |
.env.example
| @@ -19,7 +19,7 @@ CUSTOMER_ID=customer1 | @@ -19,7 +19,7 @@ CUSTOMER_ID=customer1 | ||
| 19 | 19 | ||
| 20 | # API Service Configuration | 20 | # API Service Configuration |
| 21 | API_HOST=0.0.0.0 | 21 | API_HOST=0.0.0.0 |
| 22 | -API_PORT=8000 | 22 | +API_PORT=6002 |
| 23 | 23 | ||
| 24 | # Embedding Models | 24 | # Embedding Models |
| 25 | TEXT_MODEL_DIR=/data/tw/models/bge-m3 | 25 | TEXT_MODEL_DIR=/data/tw/models/bge-m3 |
DEPLOYMENT.md
| @@ -36,7 +36,7 @@ cd /data/tw/SearchEngine | @@ -36,7 +36,7 @@ cd /data/tw/SearchEngine | ||
| 36 | ./start_all.sh | 36 | ./start_all.sh |
| 37 | ``` | 37 | ``` |
| 38 | 38 | ||
| 39 | -然后访问: http://localhost:8080 | 39 | +然后访问: http://localhost:6003 |
| 40 | 40 | ||
| 41 | ### 方式2: 分步启动 | 41 | ### 方式2: 分步启动 |
| 42 | 42 | ||
| @@ -88,7 +88,7 @@ DEEPL_AUTH_KEY=c9293ab4-ad25-479b-919f-ab4e63b429ed | @@ -88,7 +88,7 @@ DEEPL_AUTH_KEY=c9293ab4-ad25-479b-919f-ab4e63b429ed | ||
| 88 | 88 | ||
| 89 | CUSTOMER_ID=customer1 | 89 | CUSTOMER_ID=customer1 |
| 90 | API_HOST=0.0.0.0 | 90 | API_HOST=0.0.0.0 |
| 91 | -API_PORT=8000 | 91 | +API_PORT=6002 |
| 92 | ``` | 92 | ``` |
| 93 | 93 | ||
| 94 | ## 服务端口 | 94 | ## 服务端口 |
| @@ -96,9 +96,9 @@ API_PORT=8000 | @@ -96,9 +96,9 @@ API_PORT=8000 | ||
| 96 | | 服务 | 端口 | URL | | 96 | | 服务 | 端口 | URL | |
| 97 | |------|------|-----| | 97 | |------|------|-----| |
| 98 | | Elasticsearch | 9200 | http://localhost:9200 | | 98 | | Elasticsearch | 9200 | http://localhost:9200 | |
| 99 | -| Backend API | 8000 | http://localhost:8000 | | ||
| 100 | -| Frontend Web | 8080 | http://localhost:8080 | | ||
| 101 | -| API Docs | 8000 | http://localhost:8000/docs | | 99 | +| Backend API | 6002 | http://localhost:6002 | |
| 100 | +| Frontend Web | 6003 | http://localhost:6003 | | ||
| 101 | +| API Docs | 6002 | http://localhost:6002/docs | | ||
| 102 | 102 | ||
| 103 | ## 测试流程 | 103 | ## 测试流程 |
| 104 | 104 | ||
| @@ -162,10 +162,10 @@ nohup ./scripts/start_backend.sh > logs/backend.log 2>&1 & | @@ -162,10 +162,10 @@ nohup ./scripts/start_backend.sh > logs/backend.log 2>&1 & | ||
| 162 | sleep 5 | 162 | sleep 5 |
| 163 | 163 | ||
| 164 | # 测试健康检查 | 164 | # 测试健康检查 |
| 165 | -curl http://localhost:8000/admin/health | 165 | +curl http://localhost:6002/admin/health |
| 166 | 166 | ||
| 167 | # 测试搜索 | 167 | # 测试搜索 |
| 168 | -curl -X POST http://localhost:8000/search/ \ | 168 | +curl -X POST http://localhost:6002/search/ \ |
| 169 | -H "Content-Type: application/json" \ | 169 | -H "Content-Type: application/json" \ |
| 170 | -d '{"query": "消防", "size": 5}' | 170 | -d '{"query": "消防", "size": 5}' |
| 171 | ``` | 171 | ``` |
| @@ -176,7 +176,7 @@ curl -X POST http://localhost:8000/search/ \ | @@ -176,7 +176,7 @@ curl -X POST http://localhost:8000/search/ \ | ||
| 176 | # 启动前端 | 176 | # 启动前端 |
| 177 | ./scripts/start_frontend.sh | 177 | ./scripts/start_frontend.sh |
| 178 | 178 | ||
| 179 | -# 然后在浏览器访问: http://localhost:8080 | 179 | +# 然后在浏览器访问: http://localhost:6003 |
| 180 | ``` | 180 | ``` |
| 181 | 181 | ||
| 182 | ## 故障排除 | 182 | ## 故障排除 |
| @@ -234,8 +234,8 @@ cat .env | grep ES_ | @@ -234,8 +234,8 @@ cat .env | grep ES_ | ||
| 234 | **解决**: | 234 | **解决**: |
| 235 | ```bash | 235 | ```bash |
| 236 | # 查看占用端口的进程 | 236 | # 查看占用端口的进程 |
| 237 | -lsof -i :8000 # 后端 | ||
| 238 | -lsof -i :8080 # 前端 | 237 | +lsof -i :6002 # 后端 |
| 238 | +lsof -i :6003 # 前端 | ||
| 239 | 239 | ||
| 240 | # 杀掉进程 | 240 | # 杀掉进程 |
| 241 | kill -9 <PID> | 241 | kill -9 <PID> |
| @@ -246,12 +246,12 @@ kill -9 <PID> | @@ -246,12 +246,12 @@ kill -9 <PID> | ||
| 246 | ## 下一步 | 246 | ## 下一步 |
| 247 | 247 | ||
| 248 | 1. **测试搜索功能** | 248 | 1. **测试搜索功能** |
| 249 | - - 打开 http://localhost:8080 | 249 | + - 打开 http://localhost:6003 |
| 250 | - 尝试不同的搜索查询 | 250 | - 尝试不同的搜索查询 |
| 251 | - 测试布尔操作符 | 251 | - 测试布尔操作符 |
| 252 | 252 | ||
| 253 | 2. **查看API文档** | 253 | 2. **查看API文档** |
| 254 | - - 访问 http://localhost:8000/docs | 254 | + - 访问 http://localhost:6002/docs |
| 255 | - 了解所有可用的API端点 | 255 | - 了解所有可用的API端点 |
| 256 | 256 | ||
| 257 | 3. **自定义配置** | 257 | 3. **自定义配置** |
HighLevelDesign.md
| @@ -112,6 +112,8 @@ if response.status_code == 200: | @@ -112,6 +112,8 @@ if response.status_code == 200: | ||
| 112 | 支持多种匹配方式,如AND、OR、RANK、NOTAND以及(),优先级从高到低为(),ANDNOT,AND,OR,RANK。 | 112 | 支持多种匹配方式,如AND、OR、RANK、NOTAND以及(),优先级从高到低为(),ANDNOT,AND,OR,RANK。 |
| 113 | 113 | ||
| 114 | default域的相关性,是代码里面单独计算,是特定的深度定制优化的,暂时不做配置化。 | 114 | default域的相关性,是代码里面单独计算,是特定的深度定制优化的,暂时不做配置化。 |
| 115 | +多语言搜索: | ||
| 116 | +对外提供的服务 用default域搜索就行,但是内部需要通过配置翻译为多种语言(配置几种目标语言 默认中文、英文,并且设置对应的检索域),然后分别到对应的字段搜索,中文字段到配置的中文title搜索,英文到对应的英文title搜索。 | ||
| 115 | 117 | ||
| 116 | 暂时具体实现为 bm25()+0.2*text_embedding_relevence(也就是knn检索表达式的打分) | 118 | 暂时具体实现为 bm25()+0.2*text_embedding_relevence(也就是knn检索表达式的打分) |
| 117 | bm25打分(base_query): | 119 | bm25打分(base_query): |
IMPLEMENTATION_SUMMARY.md
| @@ -251,7 +251,7 @@ python data/customer1/ingest_customer1.py \ | @@ -251,7 +251,7 @@ python data/customer1/ingest_customer1.py \ | ||
| 251 | ```bash | 251 | ```bash |
| 252 | python -m api.app \ | 252 | python -m api.app \ |
| 253 | --host 0.0.0.0 \ | 253 | --host 0.0.0.0 \ |
| 254 | - --port 8000 \ | 254 | + --port 6002 \ |
| 255 | --customer customer1 \ | 255 | --customer customer1 \ |
| 256 | --es-host http://localhost:9200 | 256 | --es-host http://localhost:9200 |
| 257 | ``` | 257 | ``` |
| @@ -260,17 +260,17 @@ python -m api.app \ | @@ -260,17 +260,17 @@ python -m api.app \ | ||
| 260 | 260 | ||
| 261 | ```bash | 261 | ```bash |
| 262 | # Simple Chinese query (auto-translates to English/Russian) | 262 | # Simple Chinese query (auto-translates to English/Russian) |
| 263 | -curl -X POST http://localhost:8000/search/ \ | 263 | +curl -X POST http://localhost:6002/search/ \ |
| 264 | -H "Content-Type: application/json" \ | 264 | -H "Content-Type: application/json" \ |
| 265 | -d '{"query": "芭比娃娃", "size": 10}' | 265 | -d '{"query": "芭比娃娃", "size": 10}' |
| 266 | 266 | ||
| 267 | # Boolean query | 267 | # Boolean query |
| 268 | -curl -X POST http://localhost:8000/search/ \ | 268 | +curl -X POST http://localhost:6002/search/ \ |
| 269 | -H "Content-Type: application/json" \ | 269 | -H "Content-Type: application/json" \ |
| 270 | -d '{"query": "toy AND (barbie OR doll) ANDNOT cheap", "size": 10}' | 270 | -d '{"query": "toy AND (barbie OR doll) ANDNOT cheap", "size": 10}' |
| 271 | 271 | ||
| 272 | # Query with filters | 272 | # Query with filters |
| 273 | -curl -X POST http://localhost:8000/search/ \ | 273 | +curl -X POST http://localhost:6002/search/ \ |
| 274 | -H "Content-Type: application/json" \ | 274 | -H "Content-Type: application/json" \ |
| 275 | -d '{ | 275 | -d '{ |
| 276 | "query": "消防", | 276 | "query": "消防", |
| @@ -279,7 +279,7 @@ curl -X POST http://localhost:8000/search/ \ | @@ -279,7 +279,7 @@ curl -X POST http://localhost:8000/search/ \ | ||
| 279 | }' | 279 | }' |
| 280 | 280 | ||
| 281 | # Image search | 281 | # Image search |
| 282 | -curl -X POST http://localhost:8000/search/image \ | 282 | +curl -X POST http://localhost:6002/search/image \ |
| 283 | -H "Content-Type: application/json" \ | 283 | -H "Content-Type: application/json" \ |
| 284 | -d '{ | 284 | -d '{ |
| 285 | "image_url": "https://oss.essa.cn/example.jpg", | 285 | "image_url": "https://oss.essa.cn/example.jpg", |
QUICKSTART.md
| @@ -46,10 +46,10 @@ python ingest_customer1.py \ | @@ -46,10 +46,10 @@ python ingest_customer1.py \ | ||
| 46 | 46 | ||
| 47 | # 3. Start API service | 47 | # 3. Start API service |
| 48 | cd ../.. | 48 | cd ../.. |
| 49 | -python -m api.app --host 0.0.0.0 --port 8000 | 49 | +python -m api.app --host 0.0.0.0 --port 6002 |
| 50 | 50 | ||
| 51 | # 4. Test search | 51 | # 4. Test search |
| 52 | -curl -X POST http://localhost:8000/search/ \ | 52 | +curl -X POST http://localhost:6002/search/ \ |
| 53 | -H "Content-Type: application/json" \ | 53 | -H "Content-Type: application/json" \ |
| 54 | -d '{"query": "消防", "size": 5}' | 54 | -d '{"query": "消防", "size": 5}' |
| 55 | ``` | 55 | ``` |
| @@ -72,23 +72,23 @@ python ingest_customer1.py \ | @@ -72,23 +72,23 @@ python ingest_customer1.py \ | ||
| 72 | cd ../.. | 72 | cd ../.. |
| 73 | python -m api.app \ | 73 | python -m api.app \ |
| 74 | --host 0.0.0.0 \ | 74 | --host 0.0.0.0 \ |
| 75 | - --port 8000 \ | 75 | + --port 6002 \ |
| 76 | --customer customer1 \ | 76 | --customer customer1 \ |
| 77 | --es-host http://localhost:9200 | 77 | --es-host http://localhost:9200 |
| 78 | 78 | ||
| 79 | # 4. Test various searches | 79 | # 4. Test various searches |
| 80 | # Simple search | 80 | # Simple search |
| 81 | -curl -X POST http://localhost:8000/search/ \ | 81 | +curl -X POST http://localhost:6002/search/ \ |
| 82 | -H "Content-Type: application/json" \ | 82 | -H "Content-Type: application/json" \ |
| 83 | -d '{"query": "芭比娃娃", "size": 10}' | 83 | -d '{"query": "芭比娃娃", "size": 10}' |
| 84 | 84 | ||
| 85 | # Boolean search | 85 | # Boolean search |
| 86 | -curl -X POST http://localhost:8000/search/ \ | 86 | +curl -X POST http://localhost:6002/search/ \ |
| 87 | -H "Content-Type: application/json" \ | 87 | -H "Content-Type: application/json" \ |
| 88 | -d '{"query": "toy AND (barbie OR doll)", "size": 10}' | 88 | -d '{"query": "toy AND (barbie OR doll)", "size": 10}' |
| 89 | 89 | ||
| 90 | # With filters | 90 | # With filters |
| 91 | -curl -X POST http://localhost:8000/search/ \ | 91 | +curl -X POST http://localhost:6002/search/ \ |
| 92 | -H "Content-Type: application/json" \ | 92 | -H "Content-Type: application/json" \ |
| 93 | -d '{"query": "娃娃", "size": 10, "filters": {"categoryName_keyword": "芭比"}}' | 93 | -d '{"query": "娃娃", "size": 10, "filters": {"categoryName_keyword": "芭比"}}' |
| 94 | ``` | 94 | ``` |
| @@ -96,8 +96,8 @@ curl -X POST http://localhost:8000/search/ \ | @@ -96,8 +96,8 @@ curl -X POST http://localhost:8000/search/ \ | ||
| 96 | ## API Documentation | 96 | ## API Documentation |
| 97 | 97 | ||
| 98 | Once the service is running, visit: | 98 | Once the service is running, visit: |
| 99 | -- **Swagger UI**: http://localhost:8000/docs | ||
| 100 | -- **ReDoc**: http://localhost:8000/redoc | 99 | +- **Swagger UI**: http://localhost:6002/docs |
| 100 | +- **ReDoc**: http://localhost:6002/redoc | ||
| 101 | 101 | ||
| 102 | ## Common Issues | 102 | ## Common Issues |
| 103 | 103 | ||
| @@ -131,33 +131,33 @@ export DEEPL_API_KEY="your-key" | @@ -131,33 +131,33 @@ export DEEPL_API_KEY="your-key" | ||
| 131 | 131 | ||
| 132 | ### Test Health | 132 | ### Test Health |
| 133 | ```bash | 133 | ```bash |
| 134 | -curl http://localhost:8000/admin/health | 134 | +curl http://localhost:6002/admin/health |
| 135 | ``` | 135 | ``` |
| 136 | 136 | ||
| 137 | ### Test Configuration | 137 | ### Test Configuration |
| 138 | ```bash | 138 | ```bash |
| 139 | -curl http://localhost:8000/admin/config | 139 | +curl http://localhost:6002/admin/config |
| 140 | ``` | 140 | ``` |
| 141 | 141 | ||
| 142 | ### Test Index Stats | 142 | ### Test Index Stats |
| 143 | ```bash | 143 | ```bash |
| 144 | -curl http://localhost:8000/admin/stats | 144 | +curl http://localhost:6002/admin/stats |
| 145 | ``` | 145 | ``` |
| 146 | 146 | ||
| 147 | ### Test Search | 147 | ### Test Search |
| 148 | ```bash | 148 | ```bash |
| 149 | # Chinese query (auto-translates to English/Russian) | 149 | # Chinese query (auto-translates to English/Russian) |
| 150 | -curl -X POST http://localhost:8000/search/ \ | 150 | +curl -X POST http://localhost:6002/search/ \ |
| 151 | -H "Content-Type: application/json" \ | 151 | -H "Content-Type: application/json" \ |
| 152 | -d '{"query": "消防套", "size": 5}' | 152 | -d '{"query": "消防套", "size": 5}' |
| 153 | 153 | ||
| 154 | # English query | 154 | # English query |
| 155 | -curl -X POST http://localhost:8000/search/ \ | 155 | +curl -X POST http://localhost:6002/search/ \ |
| 156 | -H "Content-Type: application/json" \ | 156 | -H "Content-Type: application/json" \ |
| 157 | -d '{"query": "fire control set", "size": 5}' | 157 | -d '{"query": "fire control set", "size": 5}' |
| 158 | 158 | ||
| 159 | # Russian query | 159 | # Russian query |
| 160 | -curl -X POST http://localhost:8000/search/ \ | 160 | +curl -X POST http://localhost:6002/search/ \ |
| 161 | -H "Content-Type: application/json" \ | 161 | -H "Content-Type: application/json" \ |
| 162 | -d '{"query": "Наборы для пожаротушения", "size": 5}' | 162 | -d '{"query": "Наборы для пожаротушения", "size": 5}' |
| 163 | ``` | 163 | ``` |
| @@ -193,4 +193,4 @@ For issues or questions, refer to: | @@ -193,4 +193,4 @@ For issues or questions, refer to: | ||
| 193 | - **README.md**: Comprehensive documentation | 193 | - **README.md**: Comprehensive documentation |
| 194 | - **IMPLEMENTATION_SUMMARY.md**: Technical details | 194 | - **IMPLEMENTATION_SUMMARY.md**: Technical details |
| 195 | - **CLAUDE.md**: Development guidelines | 195 | - **CLAUDE.md**: Development guidelines |
| 196 | -- **API Docs**: http://localhost:8000/docs | 196 | +- **API Docs**: http://localhost:6002/docs |
USER_GUIDE.md
| @@ -16,9 +16,9 @@ cd /data/tw/SearchEngine | @@ -16,9 +16,9 @@ cd /data/tw/SearchEngine | ||
| 16 | 4. 启动前端Web界面 | 16 | 4. 启动前端Web界面 |
| 17 | 17 | ||
| 18 | 启动完成后,访问: | 18 | 启动完成后,访问: |
| 19 | -- **前端界面**: http://localhost:8080 | ||
| 20 | -- **后端API**: http://localhost:8000 | ||
| 21 | -- **API文档**: http://localhost:8000/docs | 19 | +- **前端界面**: http://localhost:6003 |
| 20 | +- **后端API**: http://localhost:6002 | ||
| 21 | +- **API文档**: http://localhost:6002/docs | ||
| 22 | 22 | ||
| 23 | ### 停止服务 | 23 | ### 停止服务 |
| 24 | 24 | ||
| @@ -65,7 +65,7 @@ cd /data/tw/SearchEngine | @@ -65,7 +65,7 @@ cd /data/tw/SearchEngine | ||
| 65 | ./scripts/start_backend.sh | 65 | ./scripts/start_backend.sh |
| 66 | ``` | 66 | ``` |
| 67 | 67 | ||
| 68 | -后端API会在 http://localhost:8000 启动 | 68 | +后端API会在 http://localhost:6002 启动 |
| 69 | 69 | ||
| 70 | ### 4. 启动前端 | 70 | ### 4. 启动前端 |
| 71 | 71 | ||
| @@ -73,7 +73,7 @@ cd /data/tw/SearchEngine | @@ -73,7 +73,7 @@ cd /data/tw/SearchEngine | ||
| 73 | ./scripts/start_frontend.sh | 73 | ./scripts/start_frontend.sh |
| 74 | ``` | 74 | ``` |
| 75 | 75 | ||
| 76 | -前端界面会在 http://localhost:8080 启动 | 76 | +前端界面会在 http://localhost:6003 启动 |
| 77 | 77 | ||
| 78 | --- | 78 | --- |
| 79 | 79 | ||
| @@ -100,7 +100,7 @@ CUSTOMER_ID=customer1 | @@ -100,7 +100,7 @@ CUSTOMER_ID=customer1 | ||
| 100 | 100 | ||
| 101 | # API服务配置 | 101 | # API服务配置 |
| 102 | API_HOST=0.0.0.0 | 102 | API_HOST=0.0.0.0 |
| 103 | -API_PORT=8000 | 103 | +API_PORT=6002 |
| 104 | ``` | 104 | ``` |
| 105 | 105 | ||
| 106 | ### 修改配置 | 106 | ### 修改配置 |
| @@ -143,7 +143,7 @@ API_PORT=8000 | @@ -143,7 +143,7 @@ API_PORT=8000 | ||
| 143 | ### 搜索接口 | 143 | ### 搜索接口 |
| 144 | 144 | ||
| 145 | ```bash | 145 | ```bash |
| 146 | -curl -X POST http://localhost:8000/search/ \ | 146 | +curl -X POST http://localhost:6002/search/ \ |
| 147 | -H "Content-Type: application/json" \ | 147 | -H "Content-Type: application/json" \ |
| 148 | -d '{ | 148 | -d '{ |
| 149 | "query": "芭比娃娃", | 149 | "query": "芭比娃娃", |
| @@ -156,7 +156,7 @@ curl -X POST http://localhost:8000/search/ \ | @@ -156,7 +156,7 @@ curl -X POST http://localhost:8000/search/ \ | ||
| 156 | ### 图片搜索 | 156 | ### 图片搜索 |
| 157 | 157 | ||
| 158 | ```bash | 158 | ```bash |
| 159 | -curl -X POST http://localhost:8000/search/image \ | 159 | +curl -X POST http://localhost:6002/search/image \ |
| 160 | -H "Content-Type: application/json" \ | 160 | -H "Content-Type: application/json" \ |
| 161 | -d '{ | 161 | -d '{ |
| 162 | "image_url": "https://oss.essa.cn/example.jpg", | 162 | "image_url": "https://oss.essa.cn/example.jpg", |
| @@ -167,19 +167,19 @@ curl -X POST http://localhost:8000/search/image \ | @@ -167,19 +167,19 @@ curl -X POST http://localhost:8000/search/image \ | ||
| 167 | ### 健康检查 | 167 | ### 健康检查 |
| 168 | 168 | ||
| 169 | ```bash | 169 | ```bash |
| 170 | -curl http://localhost:8000/admin/health | 170 | +curl http://localhost:6002/admin/health |
| 171 | ``` | 171 | ``` |
| 172 | 172 | ||
| 173 | ### 查看配置 | 173 | ### 查看配置 |
| 174 | 174 | ||
| 175 | ```bash | 175 | ```bash |
| 176 | -curl http://localhost:8000/admin/config | 176 | +curl http://localhost:6002/admin/config |
| 177 | ``` | 177 | ``` |
| 178 | 178 | ||
| 179 | ### 索引统计 | 179 | ### 索引统计 |
| 180 | 180 | ||
| 181 | ```bash | 181 | ```bash |
| 182 | -curl http://localhost:8000/admin/stats | 182 | +curl http://localhost:6002/admin/stats |
| 183 | ``` | 183 | ``` |
| 184 | 184 | ||
| 185 | --- | 185 | --- |
| @@ -231,7 +231,7 @@ cat .env | grep ES_ | @@ -231,7 +231,7 @@ cat .env | grep ES_ | ||
| 231 | **问题**: CORS错误 | 231 | **问题**: CORS错误 |
| 232 | 232 | ||
| 233 | **解决**: | 233 | **解决**: |
| 234 | -- 确保后端在 http://localhost:8000 运行 | 234 | +- 确保后端在 http://localhost:6002 运行 |
| 235 | - 检查浏览器控制台错误信息 | 235 | - 检查浏览器控制台错误信息 |
| 236 | 236 | ||
| 237 | --- | 237 | --- |
| @@ -339,5 +339,5 @@ SearchEngine/ | @@ -339,5 +339,5 @@ SearchEngine/ | ||
| 339 | 339 | ||
| 340 | 遇到问题请查看: | 340 | 遇到问题请查看: |
| 341 | - **日志**: `logs/backend.log` | 341 | - **日志**: `logs/backend.log` |
| 342 | -- **API文档**: http://localhost:8000/docs | 342 | +- **API文档**: http://localhost:6002/docs |
| 343 | - **配置**: `config/schema/customer1_config.yaml` | 343 | - **配置**: `config/schema/customer1_config.yaml` |
api/app.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | Main FastAPI application for the search service. | 2 | Main FastAPI application for the search service. |
| 3 | 3 | ||
| 4 | Usage: | 4 | Usage: |
| 5 | - uvicorn api.app:app --host 0.0.0.0 --port 8000 --reload | 5 | + uvicorn api.app:app --host 0.0.0.0 --port 6002 --reload |
| 6 | """ | 6 | """ |
| 7 | 7 | ||
| 8 | import os | 8 | import os |
| @@ -161,7 +161,7 @@ if __name__ == "__main__": | @@ -161,7 +161,7 @@ if __name__ == "__main__": | ||
| 161 | 161 | ||
| 162 | parser = argparse.ArgumentParser(description='Start search API service') | 162 | parser = argparse.ArgumentParser(description='Start search API service') |
| 163 | parser.add_argument('--host', default='0.0.0.0', help='Host to bind to') | 163 | parser.add_argument('--host', default='0.0.0.0', help='Host to bind to') |
| 164 | - parser.add_argument('--port', type=int, default=8000, help='Port to bind to') | 164 | + parser.add_argument('--port', type=int, default=6002, help='Port to bind to') |
| 165 | parser.add_argument('--customer', default='customer1', help='Customer ID') | 165 | parser.add_argument('--customer', default='customer1', help='Customer ID') |
| 166 | parser.add_argument('--es-host', default='http://localhost:9200', help='Elasticsearch host') | 166 | parser.add_argument('--es-host', default='http://localhost:9200', help='Elasticsearch host') |
| 167 | parser.add_argument('--reload', action='store_true', help='Enable auto-reload') | 167 | parser.add_argument('--reload', action='store_true', help='Enable auto-reload') |
config/env_config.py
| @@ -36,7 +36,7 @@ CUSTOMER_ID = os.getenv('CUSTOMER_ID', 'customer1') | @@ -36,7 +36,7 @@ CUSTOMER_ID = os.getenv('CUSTOMER_ID', 'customer1') | ||
| 36 | 36 | ||
| 37 | # API Service Configuration | 37 | # API Service Configuration |
| 38 | API_HOST = os.getenv('API_HOST', '0.0.0.0') | 38 | API_HOST = os.getenv('API_HOST', '0.0.0.0') |
| 39 | -API_PORT = int(os.getenv('API_PORT', 8000)) | 39 | +API_PORT = int(os.getenv('API_PORT', 6002)) |
| 40 | 40 | ||
| 41 | # Model Directories | 41 | # Model Directories |
| 42 | TEXT_MODEL_DIR = os.getenv('TEXT_MODEL_DIR', '/data/tw/models/bge-m3') | 42 | TEXT_MODEL_DIR = os.getenv('TEXT_MODEL_DIR', '/data/tw/models/bge-m3') |
frontend/index.html
| @@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
| 51 | </div> | 51 | </div> |
| 52 | 52 | ||
| 53 | <footer> | 53 | <footer> |
| 54 | - <p>SearchEngine © 2025 | API服务地址: <span id="apiUrl">http://localhost:8000</span></p> | 54 | + <p>SearchEngine © 2025 | API服务地址: <span id="apiUrl">http://localhost:6002</span></p> |
| 55 | </footer> | 55 | </footer> |
| 56 | 56 | ||
| 57 | <script src="/static/js/app.js"></script> | 57 | <script src="/static/js/app.js"></script> |
frontend/static/js/app.js
| 1 | // SearchEngine Frontend JavaScript | 1 | // SearchEngine Frontend JavaScript |
| 2 | 2 | ||
| 3 | // API endpoint | 3 | // API endpoint |
| 4 | -const API_BASE_URL = 'http://localhost:8000'; | 4 | +const API_BASE_URL = 'http://localhost:6002'; |
| 5 | 5 | ||
| 6 | // Update API URL display | 6 | // Update API URL display |
| 7 | document.getElementById('apiUrl').textContent = API_BASE_URL; | 7 | document.getElementById('apiUrl').textContent = API_BASE_URL; |
| @@ -68,7 +68,7 @@ async function performSearch() { | @@ -68,7 +68,7 @@ async function performSearch() { | ||
| 68 | <div class="error-message"> | 68 | <div class="error-message"> |
| 69 | <strong>搜索出错:</strong> ${error.message} | 69 | <strong>搜索出错:</strong> ${error.message} |
| 70 | <br><br> | 70 | <br><br> |
| 71 | - <small>请确保后端服务正在运行 (http://localhost:8000)</small> | 71 | + <small>请确保后端服务正在运行 (http://localhost:6002)</small> |
| 72 | </div> | 72 | </div> |
| 73 | `; | 73 | `; |
| 74 | } finally { | 74 | } finally { |
main.py
| @@ -151,7 +151,7 @@ def main(): | @@ -151,7 +151,7 @@ def main(): | ||
| 151 | serve_parser = subparsers.add_parser('serve', help='Start API service') | 151 | serve_parser = subparsers.add_parser('serve', help='Start API service') |
| 152 | serve_parser.add_argument('--customer', default='customer1', help='Customer ID') | 152 | serve_parser.add_argument('--customer', default='customer1', help='Customer ID') |
| 153 | serve_parser.add_argument('--host', default='0.0.0.0', help='Host to bind to') | 153 | serve_parser.add_argument('--host', default='0.0.0.0', help='Host to bind to') |
| 154 | - serve_parser.add_argument('--port', type=int, default=8000, help='Port to bind to') | 154 | + serve_parser.add_argument('--port', type=int, default=6002, help='Port to bind to') |
| 155 | serve_parser.add_argument('--es-host', default='http://localhost:9200', help='Elasticsearch host') | 155 | serve_parser.add_argument('--es-host', default='http://localhost:9200', help='Elasticsearch host') |
| 156 | serve_parser.add_argument('--reload', action='store_true', help='Enable auto-reload') | 156 | serve_parser.add_argument('--reload', action='store_true', help='Enable auto-reload') |
| 157 | 157 |
scripts/frontend_server.py
| @@ -12,7 +12,7 @@ import sys | @@ -12,7 +12,7 @@ import sys | ||
| 12 | frontend_dir = os.path.join(os.path.dirname(__file__), '../frontend') | 12 | frontend_dir = os.path.join(os.path.dirname(__file__), '../frontend') |
| 13 | os.chdir(frontend_dir) | 13 | os.chdir(frontend_dir) |
| 14 | 14 | ||
| 15 | -PORT = 8080 | 15 | +PORT = 6003 |
| 16 | 16 | ||
| 17 | class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): | 17 | class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): |
| 18 | """Custom request handler with CORS support.""" | 18 | """Custom request handler with CORS support.""" |
scripts/start_frontend.sh
| @@ -16,13 +16,13 @@ echo -e "${GREEN}========================================${NC}" | @@ -16,13 +16,13 @@ echo -e "${GREEN}========================================${NC}" | ||
| 16 | echo -e "${GREEN}Starting Frontend Server${NC}" | 16 | echo -e "${GREEN}Starting Frontend Server${NC}" |
| 17 | echo -e "${GREEN}========================================${NC}" | 17 | echo -e "${GREEN}========================================${NC}" |
| 18 | 18 | ||
| 19 | -PORT=8080 | 19 | +PORT=6003 |
| 20 | 20 | ||
| 21 | echo -e "\n${YELLOW}Frontend will be available at:${NC}" | 21 | echo -e "\n${YELLOW}Frontend will be available at:${NC}" |
| 22 | echo -e " ${GREEN}http://localhost:$PORT${NC}" | 22 | echo -e " ${GREEN}http://localhost:$PORT${NC}" |
| 23 | echo "" | 23 | echo "" |
| 24 | echo -e "${YELLOW}Make sure the backend API is running at:${NC}" | 24 | echo -e "${YELLOW}Make sure the backend API is running at:${NC}" |
| 25 | -echo -e " ${GREEN}http://localhost:8000${NC}" | 25 | +echo -e " ${GREEN}http://localhost:6002${NC}" |
| 26 | echo "" | 26 | echo "" |
| 27 | 27 | ||
| 28 | python scripts/frontend_server.py | 28 | python scripts/frontend_server.py |
setup.sh
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 2 | ||
| 3 | +source /home/tw/miniconda3/etc/profile.d/conda.sh | ||
| 4 | + | ||
| 3 | # SearchEngine Setup and Startup Script | 5 | # SearchEngine Setup and Startup Script |
| 4 | # This script sets up the environment and starts all services | 6 | # This script sets up the environment and starts all services |
| 5 | 7 |
start_all.sh
| @@ -3,6 +3,8 @@ | @@ -3,6 +3,8 @@ | ||
| 3 | # One-click startup script for SearchEngine | 3 | # One-click startup script for SearchEngine |
| 4 | # This script starts everything you need | 4 | # This script starts everything you need |
| 5 | 5 | ||
| 6 | +source /home/tw/miniconda3/etc/profile.d/conda.sh | ||
| 7 | + | ||
| 6 | set -e | 8 | set -e |
| 7 | 9 | ||
| 8 | cd "$(dirname "$0")" | 10 | cd "$(dirname "$0")" |
| @@ -67,7 +69,7 @@ echo -e "${YELLOW}等待后端服务启动...${NC}" | @@ -67,7 +69,7 @@ echo -e "${YELLOW}等待后端服务启动...${NC}" | ||
| 67 | sleep 5 | 69 | sleep 5 |
| 68 | 70 | ||
| 69 | # Check if backend is running | 71 | # Check if backend is running |
| 70 | -if curl -s http://localhost:8000/admin/health > /dev/null 2>&1; then | 72 | +if curl -s http://localhost:6002/admin/health > /dev/null 2>&1; then |
| 71 | echo -e "${GREEN}✓ 后端服务运行正常${NC}" | 73 | echo -e "${GREEN}✓ 后端服务运行正常${NC}" |
| 72 | else | 74 | else |
| 73 | echo -e "${RED}✗ 后端服务启动失败,请检查日志: logs/backend.log${NC}" | 75 | echo -e "${RED}✗ 后端服务启动失败,请检查日志: logs/backend.log${NC}" |
| @@ -81,9 +83,9 @@ echo -e "${GREEN}所有服务启动完成!${NC}" | @@ -81,9 +83,9 @@ echo -e "${GREEN}所有服务启动完成!${NC}" | ||
| 81 | echo -e "${GREEN}========================================${NC}" | 83 | echo -e "${GREEN}========================================${NC}" |
| 82 | echo "" | 84 | echo "" |
| 83 | echo -e "访问地址:" | 85 | echo -e "访问地址:" |
| 84 | -echo -e " ${GREEN}前端界面: http://localhost:8080${NC}" | ||
| 85 | -echo -e " ${GREEN}后端API: http://localhost:8000${NC}" | ||
| 86 | -echo -e " ${GREEN}API文档: http://localhost:8000/docs${NC}" | 86 | +echo -e " ${GREEN}前端界面: http://localhost:6003${NC}" |
| 87 | +echo -e " ${GREEN}后端API: http://localhost:6002${NC}" | ||
| 88 | +echo -e " ${GREEN}API文档: http://localhost:6002/docs${NC}" | ||
| 87 | echo "" | 89 | echo "" |
| 88 | echo -e "日志文件:" | 90 | echo -e "日志文件:" |
| 89 | echo -e " 后端: logs/backend.log" | 91 | echo -e " 后端: logs/backend.log" |