Skip to content
Appearance
AI功能接口
AI生成简单页面
基本信息
Path: /app-center/api/ai/chat
Method: POST
接口描述:
异常响应实例
{ "data":null, "locale":"zh-cn", "error": { "code":"CM002", "message":"参数错误"}, "err_msg":"Additional properties are not allowed ('role1' was unexpected) - 'messages.0'"}
请求参数
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| foundationModel | object | 非必须 | AI 大模型信息 | ||
| ├─ manufacturer | string | 非必须 | 大模型厂商 | 枚举: openai,baidu | |
| ├─ model | string | 非必须 | 大模型名称 | 枚举: gpt-3.5-turbo,ERNIE-Bot-turbo | |
| messages | object [] | 必须 | chat信息 | item 类型: object | |
| ├─ role | string | 必须 | 信息角色 | ||
| ├─ content | string | 必须 | 信息内容 | ||
| ├─ name | string | 必须 | 角色名称 |
返回数据
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| data | object | 非必须 | |||
| ├─ originalResponse | object | 必须 | 请求AI api返回对象 | ||
| ├─ id | string | 非必须 | 请求的唯一标识符 | ||
| ├─ object | string | 非必须 | 响应对象的类型 | ||
| ├─ created | number | 非必须 | 响应创建的时间戳 | ||
| ├─ choices | object [] | 必须 | item 类型: object | ||
| ├─ index | number | 非必须 | 生成文本的索引号 | ||
| ├─ message | object | 非必须 | AI返回的信息 | ||
| ├─ role | string | 非必须 | 角色 | ||
| ├─ content | string | 非必须 | 内容 | ||
| ├─ finish_reason | string | 非必须 | 完成生成的原因,通常是"stop" | ||
| ├─ usage | object | 非必须 | token使用量 | ||
| ├─ prompt_tokens | number | 非必须 | |||
| ├─ completion_tokens | number | 非必须 | |||
| ├─ total_tokens | number | 非必须 | |||
| ├─ schema | object | 非必须 | 页面schema | ||
| ├─ status | number | 非必须 | 状态 | ||
| ├─ message | string | 非必须 | 信息 | ||
| ├─ schema | object | 非必须 | 页面schema | ||
| ├─ componentName | string | 非必须 | 组件或区块名 | ||
| ├─ css | string | 非必须 | 全局css样式 | ||
| ├─ props | object | 非必须 | 属性 | ||
| ├─ lifeCycles | object | 非必须 | 生命周期 | ||
| ├─ children | string [] | 非必须 | 子组件列表或字符串 | item 类型: string | |
| ├─ | 非必须 | ||||
| ├─ dataSource | object | 非必须 | 数据源 | ||
| ├─ list | string [] | 非必须 | item 类型: string | ||
| ├─ | 非必须 | ||||
| ├─ state | object | 非必须 | 页面的state | ||
| ├─ methods | object | 非必须 | 声明的方法 | ||
| ├─ utils | string [] | 非必须 | 工具类 | item 类型: string | |
| ├─ | 非必须 | ||||
| ├─ bridge | string [] | 非必须 | 桥接源 | item 类型: string | |
| ├─ | 非必须 | ||||
| ├─ inputs | string [] | 非必须 | item 类型: string | ||
| ├─ | 非必须 | ||||
| ├─ outputs | string [] | 非必须 | item 类型: string | ||
| ├─ | 非必须 | ||||
| ├─ replyWithoutCode | string | 非必须 | 去掉代码的回复内容 | ||
| locale | string | 非必须 |