fix(gateway): constrain verified Qwen replies to emotion schema
This commit is contained in:
@@ -3,6 +3,17 @@ from dataclasses import dataclass
|
||||
import json
|
||||
import re
|
||||
|
||||
REPLY_SCHEMA = {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'reply': {'type': 'string'},
|
||||
'emotion': {'type': 'string', 'enum': ['neutral', 'happy', 'angry', 'sad']},
|
||||
'intensity': {'type': 'integer', 'enum': [0, 1, 2]},
|
||||
},
|
||||
'required': ['reply', 'emotion', 'intensity'],
|
||||
'additionalProperties': False,
|
||||
}
|
||||
|
||||
SYSTEM_FRAGMENT = '''本轮只输出一个JSON对象,格式为{"reply":"简短中文回答","emotion":"neutral","intensity":0},不加代码围栏或额外文字。reply直接回答用户,最多两小句,不含情绪标签、动作旁白或思考过程。emotion是角色本轮表达意图,不是用户心理判断;只允许neutral(intensity=0)、happy/angry/sad(intensity=1轻度或2明显)。普通问答默认neutral;帮助性和用户台词优先,不为表演牺牲回答,不根据摄像头皱眉强行生气或攻击。每轮仅一个主情绪,无混合或长期状态。'''
|
||||
SAFE_REPLY = '抱歉,这次回答格式有误,请再说一次。'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user