feat: Add Python project dependencies.

This commit is contained in:
hblu 2026-01-04 19:39:06 +08:00
parent 7b16871943
commit c79709d08f

View File

@ -133,6 +133,22 @@ uv --version # 应显示 uv 0.x.x
```bash
uv add streamlit chainlit openai python-dotenv
```
> [!TIP]
> **国内用户加速指南 (Domestic Mirror)**:
> 建议配置国内镜像源(如清华源)以获得极速体验。
> **全局配置 (Global Config)**:
> ```bash
> # macOS/Linux
> mkdir -p ~/.config/uv
> echo '[[index]]' > ~/.config/uv/uv.toml
> echo 'url = "https://pypi.tuna.tsinghua.edu.cn/simple"' >> ~/.config/uv/uv.toml
> echo 'default = true' >> ~/.config/uv/uv.toml
>
> # Windows (PowerShell)
> md -Force $env:APPDATA\uv
> @('[[index]]', 'url = "https://pypi.tuna.tsinghua.edu.cn/simple"', 'default = true') | Set-Content $env:APPDATA\uv\uv.toml
> ```
3. **运行 (Run)**: 一键启动,无需担心环境冲突。
```bash
uv run main.py
@ -245,7 +261,7 @@ class MovieScript(BaseModel):
# PydanticAI 会自动识别 'deepseek:deepseek-chat' 并从环境变量加载 API Key
agent = Agent(
'deepseek:deepseek-chat',
result_type=MovieScript,
output_type=MovieScript,
system_prompt="你是一个好莱坞金牌编剧,擅长写出人意料的剧本。"
)