> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monostate.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 启动聊天

> 启动聊天界面以测试您的模型

# 启动聊天界面

聊天界面允许您在浏览器中与训练好的模型进行交互。

## 快速开始

```bash theme={null}
aitraining chat
```

浏览器将自动打开到 `http://localhost:7860/inference`。

## 命令选项

```bash theme={null}
aitraining chat [OPTIONS]

Options:
  --port PORT    Port to run on (default: 7860)
  --host HOST    Host to bind to (default: 127.0.0.1)
```

### 示例

```bash theme={null}
# 默认 (localhost:7860)
aitraining chat

# 自定义端口
aitraining chat --port 3000

# 可从其他机器访问
aitraining chat --host 0.0.0.0 --port 7860
```

## 要求

启动前，您需要：

* 一个训练好的模型（本地路径或 Hugging Face 模型 ID）
* 足够的内存来加载模型

## 典型工作流程

1. 训练模型：
   ```bash theme={null}
   aitraining llm --train \
     --model meta-llama/Llama-3.2-1B \
     --data-path ./my-data \
     --project-name my-model
   ```

2. 启动聊天：
   ```bash theme={null}
   aitraining chat
   ```

3. 浏览器自动打开到 `localhost:7860/inference`

4. 从 `./my-model` 加载您训练好的模型

5. 开始聊天

## 停止服务器

在终端中按 `Ctrl+C` 停止聊天服务器。

## 故障排除

<AccordionGroup>
  <Accordion title="端口已被占用">
    另一个进程正在使用端口 7860。您可以：

    * 停止另一个进程
    * 使用不同的端口：`aitraining chat --port 3000`
  </Accordion>

  <Accordion title="模型无法加载">
    检查：

    * 模型路径是否正确
    * GPU/RAM 内存是否充足
    * 模型格式是否兼容（Hugging Face 格式）
  </Accordion>

  <Accordion title="无法从其他机器访问">
    使用 `--host 0.0.0.0` 绑定到所有接口：

    ```bash theme={null}
    aitraining chat --host 0.0.0.0
    ```
  </Accordion>
</AccordionGroup>

## 下一步

<CardGroup cols={2}>
  <Card title="界面概览" href="/chat/interface-overview">
    了解聊天界面
  </Card>

  <Card title="加载模型" href="/chat/loading-models">
    加载和切换模型
  </Card>
</CardGroup>
