- 新增完整的 Home Assistant 集成示例,支持文本对话与上下文会话 - 实现小爱音箱事件解析与 TTS 播报,支持实时打断功能 - 添加连续会话管理,支持区域上下文注入和会话超时结束 - 提供完整的配置系统、类型定义和错误处理 - 包含 Rust 扩展模块用于小爱音箱通信,支持音频流处理 - 添加单元测试、集成测试脚本和 Docker 部署支持 - 提供详细的使用文档和配置说明
54 lines
1.5 KiB
Docker
54 lines
1.5 KiB
Docker
FROM python:3.12-slim AS builder
|
|
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl build-essential pkg-config libssl-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
|
|
ENV BASH_ENV=/root/.bash_env
|
|
RUN touch "$BASH_ENV"
|
|
RUN echo '. "$BASH_ENV"' >> "$HOME/.bashrc"
|
|
RUN echo '[ -s "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"' >> "$BASH_ENV"
|
|
|
|
WORKDIR /app
|
|
|
|
COPY examples/hass/hass ./hass
|
|
COPY examples/hass/src ./src
|
|
COPY examples/hass/Cargo.toml ./Cargo.toml
|
|
COPY examples/hass/pyproject.toml ./pyproject.toml
|
|
COPY examples/hass/README.md ./README.md
|
|
COPY examples/hass/requirements.txt ./requirements.txt
|
|
COPY examples/hass/hass_assistant.py ./hass_assistant.py
|
|
COPY examples/hass/config.example.json ./config.example.json
|
|
COPY packages/client-rust ./client-rust
|
|
|
|
RUN python -m venv /opt/venv
|
|
ENV VIRTUAL_ENV=/opt/venv
|
|
ENV PATH="/opt/venv/bin:${PATH}"
|
|
|
|
RUN pip install --upgrade pip
|
|
RUN pip install -r requirements.txt
|
|
RUN pip install maturin
|
|
|
|
RUN sed -i 's/\.\.\/\.\.\/packages\///g' Cargo.toml \
|
|
&& maturin develop --release
|
|
|
|
|
|
|
|
FROM python:3.12-slim
|
|
|
|
ENV VIRTUAL_ENV=/opt/venv
|
|
ENV PATH="/opt/venv/bin:${PATH}"
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /opt/venv /opt/venv
|
|
COPY --from=builder /app/hass /app/hass
|
|
COPY --from=builder /app/hass_assistant.py /app/hass_assistant.py
|
|
COPY --from=builder /app/config.example.json /app/config.example.json
|
|
|
|
CMD ["python", "hass_assistant.py"]
|