diff --git a/.env.example b/.env.example index 8c9f7c6..424755c 100644 --- a/.env.example +++ b/.env.example @@ -5,11 +5,11 @@ APP_DEBUG=false # 功能手板 gRPC(与 HTTP 同进程;明文无鉴权,生产勿对公网裸暴露) GRPC_HOST=0.0.0.0 -GRPC_PORT=50050 +GRPC_PORT=50065 GRPC_ENABLED=true # 量产 gRPC -SOMNI_GRPC_PORT=50055 +SOMNI_GRPC_PORT=50064 SOMNI_GRPC_ENABLED=true # Elasticsearch(功能手板) diff --git a/README.md b/README.md index 12fc596..fe9e20e 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ **Somni / 功能手板音频检索服务**:三维度检索为核心;HTTP 保留;同进程再对外暴露功能手板与量产两套 gRPC。 - **核心**:三维度音频检索(ES 召回 + 标签词典向量 + 精排) -- **功能手板**:`MONGO_*` + `ES_NODE` + `REDIS_URL`;HTTP `:8080` + gRPC `:50050` -- **量产**:`SOMNI_MONGO_*` + `SOMNI_ES_*` + `SOMNI_REDIS_URL`;gRPC `:50055` +- **功能手板**:`MONGO_*` + `ES_NODE` + `REDIS_URL`;HTTP `:8080` + gRPC `:50065` +- **量产**:`SOMNI_MONGO_*` + `SOMNI_ES_*` + `SOMNI_REDIS_URL`;gRPC `:50064` - **写路径**:直连 Mongo,再同步本侧 ES(不再调用 BioNode) - **接口文档**:`docs/功能手板接口文档.md`、`docs/量产接口文档.md` @@ -14,8 +14,8 @@ 算法端 / 调用方 │ ├── HTTP :8080 ──► app/api/audio ──► server/handboard(Fullive) - ├── gRPC :50050 ─► uburnode.v1(手板 audio/quiz) - └── gRPC :50055 ─► uburnode.somni.v1(量产 ListTags/ListAudios/Search/GetAnswer) + ├── gRPC :50065 ─► uburnode.v1(手板 audio/quiz) + └── gRPC :50064 ─► uburnode.somni.v1(量产 ListTags/ListAudios/Search/GetAnswer) ``` ## 目录结构 diff --git a/app/core/config.py b/app/core/config.py index 3444896..8eb4923 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -22,11 +22,11 @@ class Settings(BaseSettings): # 功能手板 gRPC(与 HTTP 同进程;false 时跳过该端口) grpc_host: str = "0.0.0.0" - grpc_port: int = 50050 + grpc_port: int = 50065 grpc_enabled: bool = True # 量产 gRPC - somni_grpc_port: int = 50055 + somni_grpc_port: int = 50064 somni_grpc_enabled: bool = True es_node: str = "http://localhost:9200" diff --git a/docker-compose.yml b/docker-compose.yml index 49209a8..28356d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,8 +28,8 @@ services: ES_NODE: http://elasticsearch:9200 REDIS_URL: redis://redis:6379/0 ports: - - "50050:50050" # 功能手板 gRPC - - "50055:50055" # 量产 gRPC + - "50065:50065" # 功能手板 gRPC + - "50064:50064" # 量产 gRPC # HTTP 仍经 nginx :8001 volumes: - hf_cache:/data/huggingface diff --git a/tests/test_grpc_server.py b/tests/test_grpc_server.py index 1f7f742..e67ea48 100644 --- a/tests/test_grpc_server.py +++ b/tests/test_grpc_server.py @@ -14,10 +14,10 @@ @pytest.mark.asyncio async def test_start_both_servers_when_enabled(monkeypatch: pytest.MonkeyPatch) -> None: fake_hb = MagicMock() - fake_hb.add_insecure_port = MagicMock(return_value=50050) + fake_hb.add_insecure_port = MagicMock(return_value=50065) fake_hb.start = AsyncMock() fake_sm = MagicMock() - fake_sm.add_insecure_port = MagicMock(return_value=50055) + fake_sm.add_insecure_port = MagicMock(return_value=50064) fake_sm.start = AsyncMock() servers = iter([fake_hb, fake_sm]) monkeypatch.setattr(