Skip to content

表白动作

接口说明

表白是一种特殊的关系触发型动作,执行后将触发AI分析判断,决定是否建立恋人关系。

请求信息

  • Method: POST
  • Path: /v1/actions/execute
  • 认证: 需要

请求参数

json
{
  "action_type": "confess"
}

执行条件

  • 亲密度等级达到 Lv.4(挚友,401分以上)
  • 尚未建立恋人关系
  • 非冷却期(失败后需等待3天)

AI判定机制

AI会综合分析用户与AI之间的互动历史、情感深度、关系成熟度等因素,判定结果为成功或失败。具体评价指标为内部实现细节(黑盒)。

响应示例(成功)

json
{
  "code": 0,
  "message": "success",
  "data": {
    "action_type": "confess",
    "action_name": "表白",
    "ai_response": "听到你的表白,我的心跳得好快...我也一直在等待这一刻,我愿意成为你的恋人!",
    "emotion": "happy",
    "success": true,
    "current_intimacy": 450,
    "current_level": "挚友",
    "relationship_status": "lover",
    "created_at": "2025-10-03T12:40:00Z"
  }
}

响应示例(失败)

json
{
  "code": 0,
  "message": "success",
  "data": {
    "action_type": "confess",
    "action_name": "表白",
    "ai_response": "谢谢你的心意,但我觉得我们现在的关系还不太适合...或许我们可以先做好朋友?",
    "emotion": "neutral",
    "success": false,
    "cooldown_until": "2025-10-06T12:40:00Z",
    "current_intimacy": 410,
    "current_level": "挚友",
    "relationship_status": "normal",
    "created_at": "2025-10-03T12:40:00Z"
  }
}

错误情况

  • 403: 等级不足(需要Lv.4)或已经是恋人
  • 422: 冷却期内(失败后3天内)
  • 500: AI分析服务异常

示例代码

bash
curl -X POST http://localhost:8081/v1/actions/execute \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "action_type": "confess"
  }'
javascript
const response = await fetch('http://localhost:8081/v1/actions/execute', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${accessToken}`
  },
  body: JSON.stringify({
    action_type: 'confess'
  })
});

const data = await response.json();
if (data.data.success) {
  console.log('表白成功!');
} else {
  console.log('表白失败,冷却至:', data.data.cooldown_until);
}
python
import requests

response = requests.post(
    'http://localhost:8081/v1/actions/execute',
    headers={
        'Authorization': f'Bearer {access_token}'
    },
    json={
        'action_type': 'confess'
    }
)

data = response.json()
if data['data']['success']:
    print('表白成功!')
else:
    print(f"表白失败,冷却至: {data['data']['cooldown_until']}")

相关内容

Released under the MIT License.