Skip to content
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
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ APP_DEBUG=false

# 功能手板 gRPC(与 HTTP 同进程;明文无鉴权,生产勿对公网裸暴露)
GRPC_HOST=0.0.0.0
GRPC_PORT=50051
GRPC_PORT=50050
GRPC_ENABLED=true

# 量产 gRPC
SOMNI_GRPC_PORT=50052
SOMNI_GRPC_PORT=50051
SOMNI_GRPC_ENABLED=true

# Elasticsearch(功能手板)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
**Somni / 功能手板音频检索服务**:三维度检索为核心;HTTP 保留;同进程再对外暴露功能手板与量产两套 gRPC。

- **核心**:三维度音频检索(ES 召回 + 标签词典向量 + 精排)
- **功能手板**:`MONGO_*` + `ES_NODE` + `REDIS_URL`;HTTP `:8080` + gRPC `:50051`
- **量产**:`SOMNI_MONGO_*` + `SOMNI_ES_*` + `SOMNI_REDIS_URL`;gRPC `:50052`
- **功能手板**:`MONGO_*` + `ES_NODE` + `REDIS_URL`;HTTP `:8080` + gRPC `:50050`
- **量产**:`SOMNI_MONGO_*` + `SOMNI_ES_*` + `SOMNI_REDIS_URL`;gRPC `:50051`
- **写路径**:直连 Mongo,再同步本侧 ES(不再调用 BioNode)
- **接口文档**:`docs/功能手板接口文档.md`、`docs/量产接口文档.md`

Expand All @@ -14,8 +14,8 @@
算法端 / 调用方
├── HTTP :8080 ──► app/api/audio ──► server/handboard(Fullive)
├── gRPC :50051 ─► uburnode.v1(手板 audio/quiz)
└── gRPC :50052 ─► uburnode.somni.v1(量产 ListTags/ListAudios/Search/GetAnswer)
├── gRPC :50050 ─► uburnode.v1(手板 audio/quiz)
└── gRPC :50051 ─► uburnode.somni.v1(量产 ListTags/ListAudios/Search/GetAnswer)
```

## 目录结构
Expand Down
4 changes: 2 additions & 2 deletions app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class Settings(BaseSettings):

# 功能手板 gRPC(与 HTTP 同进程;false 时跳过该端口)
grpc_host: str = "0.0.0.0"
grpc_port: int = 50051
grpc_port: int = 50050
grpc_enabled: bool = True

# 量产 gRPC
somni_grpc_port: int = 50052
somni_grpc_port: int = 50051
somni_grpc_enabled: bool = True

es_node: str = "http://localhost:9200"
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ services:
ES_NODE: http://elasticsearch:9200
REDIS_URL: redis://redis:6379/0
ports:
- "50051:50051" # 对外 gRPC(HTTP 仍经 nginx :8001)
- "50050:50050" # 功能手板 gRPC
- "50051:50051" # 量产 gRPC
# HTTP 仍经 nginx :8001
volumes:
- hf_cache:/data/huggingface
- ./logs:/app/logs # 宿主机可直接看项目目录 logs/YYYY-MM-DD_ubur_log
Expand Down
4 changes: 2 additions & 2 deletions tests/test_grpc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=50051)
fake_hb.add_insecure_port = MagicMock(return_value=50050)
fake_hb.start = AsyncMock()
fake_sm = MagicMock()
fake_sm.add_insecure_port = MagicMock(return_value=50052)
fake_sm.add_insecure_port = MagicMock(return_value=50051)
fake_sm.start = AsyncMock()
servers = iter([fake_hb, fake_sm])
monkeypatch.setattr(
Expand Down