from typing import Optional, List from pydantic import BaseModel class PredictRequest(BaseModel): text: str stock_codes: Optional[List[str]] = None # 定义为可选字段,可以是一个字符串列表