190 lines
4.1 KiB
YAML
190 lines
4.1 KiB
YAML
openapi: 3.0.3
|
|
info:
|
|
title: Mid Agent Runtime Hardening Provider API
|
|
version: 0.1.0
|
|
x-contract-level: L2
|
|
paths:
|
|
/mid/dialogue/respond:
|
|
post:
|
|
operationId: respondDialogue
|
|
summary: 运行时加固后的中台对话响应
|
|
x-requirements:
|
|
- AC-MARH-01
|
|
- AC-MARH-02
|
|
- AC-MARH-03
|
|
- AC-MARH-04
|
|
- AC-MARH-05
|
|
- AC-MARH-06
|
|
- AC-MARH-07
|
|
- AC-MARH-08
|
|
- AC-MARH-09
|
|
- AC-MARH-10
|
|
- AC-MARH-11
|
|
- AC-MARH-12
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/DialogueRequest'
|
|
responses:
|
|
'200':
|
|
description: 成功响应
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/DialogueResponse'
|
|
'400':
|
|
description: 请求参数错误
|
|
'500':
|
|
description: 服务内部错误
|
|
|
|
components:
|
|
schemas:
|
|
DialogueRequest:
|
|
type: object
|
|
required:
|
|
- session_id
|
|
- user_message
|
|
- history
|
|
properties:
|
|
session_id:
|
|
type: string
|
|
user_id:
|
|
type: string
|
|
user_message:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 2000
|
|
history:
|
|
type: array
|
|
description: 仅已送达历史
|
|
items:
|
|
$ref: '#/components/schemas/HistoryMessage'
|
|
interrupted_segments:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/InterruptedSegment'
|
|
humanize_config:
|
|
$ref: '#/components/schemas/HumanizeConfig'
|
|
|
|
HistoryMessage:
|
|
type: object
|
|
required:
|
|
- role
|
|
- content
|
|
properties:
|
|
role:
|
|
type: string
|
|
enum: [user, assistant, human]
|
|
content:
|
|
type: string
|
|
|
|
InterruptedSegment:
|
|
type: object
|
|
required:
|
|
- segment_id
|
|
- content
|
|
properties:
|
|
segment_id:
|
|
type: string
|
|
content:
|
|
type: string
|
|
|
|
HumanizeConfig:
|
|
type: object
|
|
properties:
|
|
enabled:
|
|
type: boolean
|
|
min_delay_ms:
|
|
type: integer
|
|
minimum: 0
|
|
max_delay_ms:
|
|
type: integer
|
|
minimum: 0
|
|
length_bucket_strategy:
|
|
type: string
|
|
enum: [simple, semantic]
|
|
|
|
DialogueResponse:
|
|
type: object
|
|
required:
|
|
- segments
|
|
- trace
|
|
properties:
|
|
segments:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/Segment'
|
|
trace:
|
|
$ref: '#/components/schemas/TraceInfo'
|
|
|
|
Segment:
|
|
type: object
|
|
required:
|
|
- segment_id
|
|
- text
|
|
- delay_after
|
|
properties:
|
|
segment_id:
|
|
type: string
|
|
text:
|
|
type: string
|
|
delay_after:
|
|
type: integer
|
|
minimum: 0
|
|
|
|
SegmentStats:
|
|
type: object
|
|
properties:
|
|
segment_count:
|
|
type: integer
|
|
avg_segment_length:
|
|
type: number
|
|
format: float
|
|
humanize_strategy:
|
|
type: string
|
|
|
|
TraceInfo:
|
|
type: object
|
|
required:
|
|
- mode
|
|
properties:
|
|
mode:
|
|
type: string
|
|
enum: [agent, micro_flow, fixed, transfer]
|
|
request_id:
|
|
type: string
|
|
generation_id:
|
|
type: string
|
|
guardrail_triggered:
|
|
type: boolean
|
|
guardrail_rule_id:
|
|
type: string
|
|
interrupt_consumed:
|
|
type: boolean
|
|
kb_tool_called:
|
|
type: boolean
|
|
kb_hit:
|
|
type: boolean
|
|
fallback_reason_code:
|
|
type: string
|
|
react_iterations:
|
|
type: integer
|
|
minimum: 0
|
|
maximum: 5
|
|
timeout_profile:
|
|
$ref: '#/components/schemas/TimeoutProfile'
|
|
segment_stats:
|
|
$ref: '#/components/schemas/SegmentStats'
|
|
|
|
TimeoutProfile:
|
|
type: object
|
|
properties:
|
|
per_tool_timeout_ms:
|
|
type: integer
|
|
maximum: 2000
|
|
end_to_end_timeout_ms:
|
|
type: integer
|
|
maximum: 8000
|