v3.1 + 批次0: 智能回复重构基线 - ApprovalMatcher + 关键词降级 + 文档速修 + v4.0任务书面化
This commit is contained in:
@@ -150,3 +150,23 @@ class MessageListResponse(BaseModel):
|
||||
|
||||
items: List[MessageResponse]
|
||||
has_more: bool
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# 历史消息列表响应 Schema(跨会话聚合)
|
||||
# --------------------------------------------------------------------------
|
||||
class HistoryMessageListResponse(BaseModel):
|
||||
"""历史消息列表响应(跨会话聚合)。
|
||||
|
||||
用于按员工ID聚合查询所有会话的历史消息,
|
||||
返回合并后的时间线、是否有更多消息、以及会话摘要映射。
|
||||
|
||||
Attributes:
|
||||
items: 消息列表(按时间倒序,最新在前)
|
||||
has_more: 是否还有更多历史消息
|
||||
conversation_summaries: {conversation_id: "前20字摘要"}
|
||||
"""
|
||||
|
||||
items: List[MessageResponse]
|
||||
has_more: bool
|
||||
conversation_summaries: Dict[str, str]
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
# =============================================================================
|
||||
# 企微IT智能服务台 — AI 辅助消息框请求模型
|
||||
# =============================================================================
|
||||
# 说明:坐席端 AI 辅助工具栏的 4 个功能的请求验证模型:
|
||||
# 1. AutocompleteRequest — 自动补齐
|
||||
# 2. ToneAdjustRequest — 语气调整
|
||||
# 3. PolishRequest — 文字润色
|
||||
# 4. RewriteRequest — 智能改写
|
||||
#
|
||||
# 字段约束与 PRD v1.0 / 增量设计 v1.0 对齐。
|
||||
# =============================================================================
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class AutocompleteRequest(BaseModel):
|
||||
"""自动补齐请求。
|
||||
|
||||
坐席输入停顿超过 800ms 后,前端发送当前输入文本请求补齐建议。
|
||||
|
||||
Attributes:
|
||||
current_text: 当前输入文本,至少 1 个字符
|
||||
cursor_position: 光标位置(保留字段,当前未使用)
|
||||
max_length: 补齐建议最大长度(10-200 字符,默认 80)
|
||||
"""
|
||||
current_text: str = Field(
|
||||
..., min_length=1, max_length=500,
|
||||
description="当前输入文本"
|
||||
)
|
||||
cursor_position: int = Field(
|
||||
0, ge=0,
|
||||
description="光标位置"
|
||||
)
|
||||
max_length: int = Field(
|
||||
80, ge=10, le=200,
|
||||
description="补齐最大长度"
|
||||
)
|
||||
|
||||
|
||||
class ToneAdjustRequest(BaseModel):
|
||||
"""语气调整请求。
|
||||
|
||||
坐席选中一段文字后,选择目标语气,请求 AI 改写。
|
||||
|
||||
Attributes:
|
||||
selected_text: 选中的文字,至少 1 个字符
|
||||
full_text: 输入框完整内容(可选,供 AI 理解上下文)
|
||||
tone: 目标语气,必须是 professional/friendly/concise 之一
|
||||
"""
|
||||
selected_text: str = Field(
|
||||
..., min_length=1, max_length=2000,
|
||||
description="选中的文字"
|
||||
)
|
||||
full_text: str = Field(
|
||||
"", max_length=5000,
|
||||
description="输入框完整内容"
|
||||
)
|
||||
tone: str = Field(
|
||||
..., pattern="^(professional|friendly|concise)$",
|
||||
description="目标语气:professional/friendly/concise"
|
||||
)
|
||||
|
||||
|
||||
class PolishRequest(BaseModel):
|
||||
"""文字润色请求。
|
||||
|
||||
坐席点击润色按钮后,选择操作类型,请求 AI 对输入文字进行处理。
|
||||
|
||||
Attributes:
|
||||
text: 待润色文字
|
||||
action: 润色操作类型:expand(扩写)/compress(压缩)/correct(纠错)
|
||||
conversation_context: 是否携带对话上下文(默认 True)
|
||||
"""
|
||||
text: str = Field(
|
||||
..., min_length=1, max_length=5000,
|
||||
description="待润色文字"
|
||||
)
|
||||
action: str = Field(
|
||||
..., pattern="^(expand|compress|correct)$",
|
||||
description="润色操作:expand/compress/correct"
|
||||
)
|
||||
conversation_context: bool = Field(
|
||||
True,
|
||||
description="是否携带对话上下文"
|
||||
)
|
||||
|
||||
|
||||
class RewriteRequest(BaseModel):
|
||||
"""智能改写请求。
|
||||
|
||||
坐席点击改写按钮后,AI 基于对话上下文生成多个不同风格的备选回复。
|
||||
|
||||
Attributes:
|
||||
current_text: 当前输入文本(可为空,此时 AI 仅基于对话上下文生成)
|
||||
generate_count: 生成版本数(1-5,默认 3)
|
||||
include_knowledge: 是否包含知识库引用版本(默认 True)
|
||||
"""
|
||||
current_text: str = Field(
|
||||
"", max_length=5000,
|
||||
description="当前输入文本(可为空)"
|
||||
)
|
||||
generate_count: int = Field(
|
||||
3, ge=1, le=5,
|
||||
description="生成版本数"
|
||||
)
|
||||
include_knowledge: bool = Field(
|
||||
True,
|
||||
description="是否包含知识库引用版本"
|
||||
)
|
||||
Reference in New Issue
Block a user