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=50050
GRPC_PORT=50065
GRPC_ENABLED=true

# 量产 gRPC
SOMNI_GRPC_PORT=50055
SOMNI_GRPC_PORT=50064
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 `: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`

Expand All @@ -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)
```

## 目录结构
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 = 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"
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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=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(
Expand Down