Implement feature extraction and inference enhancements, including async processing and MongoDB integration

This commit is contained in:
2026-01-30 14:43:30 +08:00
parent 3d78b88d47
commit 1bd4547b99
7 changed files with 166 additions and 3 deletions

32
services/mongo.py Normal file
View File

@@ -0,0 +1,32 @@
import datetime
import os
from typing import Dict, List, Optional
from bson import ObjectId
from motor.motor_asyncio import (
AsyncIOMotorClient,
AsyncIOMotorCollection,
AsyncIOMotorDatabase,
)
MONGO_URI = os.getenv("MONGO_URI")
MongoQueryParam = int | str | None | bool | datetime.datetime
MongoQueryListParam = (
List[int] | List[str] | List[datetime.datetime] | List[bool] | List[None]
)
MongoQueryDictParam = Dict[
str, MongoQueryListParam | MongoQueryParam | "MongoQueryDictParam"
]
MongoQuery = Dict[
str, MongoQueryDictParam | MongoQueryParam | MongoQueryListParam | "MongoQuery"
]
# 明确的类型注解
client: AsyncIOMotorClient = AsyncIOMotorClient(host=MONGO_URI)
db: AsyncIOMotorDatabase = client["TriCore"]
voice_collection: AsyncIOMotorCollection = db["voice_insight"]