You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

115 lines
3.1 KiB

basePath: /
definitions:
earphone_modules_migu.Message:
properties:
content:
description: 文本内容
type: string
role:
description: user / assistant / system
type: string
type: object
migu.ChatRequest:
properties:
deviceId:
description: 设备ID(可选,亦可用 X-Device-Id 头)
type: string
history:
description: 历史对话(可选)
items:
$ref: '#/definitions/earphone_modules_migu.Message'
type: array
message:
description: 本次问话(必填)
type: string
sessionId:
description: 会话ID(可选,亦可用 X-Session-Id 头)
type: string
stream:
description: 是否流式
type: boolean
type: object
migu.ChatResponse:
properties:
cards:
description: 全部结构化卡片(音乐等)
items:
$ref: '#/definitions/migu.Content'
type: array
content:
description: 拼接后的完整文本
type: string
finishReason:
description: 结束原因
type: string
reasoning:
description: 拼接后的完整思考
type: string
recommendPrompts:
description: 全部追问提示词
items:
type: string
type: array
reqId:
type: string
sessionId:
type: string
type: object
migu.Content:
properties:
data:
type: object
type:
type: string
type: object
info:
contact: {}
description: 移动灵犀聊天服务(咪咕灵犀),独立部署,对外提供普通聊天接口(支持流式 SSE / 非流式)。
title: Migu API
version: "1.0"
paths:
/chat:
post:
consumes:
- application/json
description: |-
普通聊天接口,内部对接咪咕灵犀。
stream=false:返回完整 JSON(ChatResponse),结构化音乐卡片在 cards 字段;
stream=true:返回 SSE 流,每帧一个 ChatChunk(音乐卡片在 card 字段),结束以 data: [DONE]。
鉴权:服务端配置了 ApiKey 时需带请求头 Authorization: Bearer <key>。
parameters:
- description: 聊天请求
in: body
name: body
required: true
schema:
$ref: '#/definitions/migu.ChatRequest'
produces:
- application/json
- text/event-stream
responses:
"200":
description: '非流式完整响应;流式时为 SSE 流(data: {ChatChunk} ... data: [DONE])'
schema:
$ref: '#/definitions/migu.ChatResponse'
"400":
description: 参数错误
schema:
additionalProperties:
type: string
type: object
"401":
description: 鉴权失败
schema:
additionalProperties:
type: string
type: object
summary: 咪咕灵犀聊天
tags:
- Migu
securityDefinitions:
BearerAuth:
in: header
name: Authorization
type: apiKey
swagger: "2.0"