feat(followup-audio): review full dialogue and bind roles before extraction

This commit is contained in:
2026-10-10 14:25:03 +08:00
parent f015b26ae1
commit b4acad8510
14 changed files with 360 additions and 43 deletions
@@ -55,13 +55,15 @@ final class FollowupAudioController extends BaseAdminController
public function create()
{
return $this->handle(true, ['diagnosis_id', 'upload_id', 'recorded_at', 'model_key'], fn (array $p): array =>
return $this->handle(true, ['diagnosis_id', 'upload_id', 'recorded_at', 'model_key', 'channel_roles'], fn (array $p): array =>
Logic::create([
'diagnosis_id' => $this->positive($p, 'diagnosis_id'),
'upload_id' => $this->textValue($p, 'upload_id', 64),
'recorded_at' => $this->textValue($p, 'recorded_at', 19),
'model_key' => $this->textValue($p, 'model_key', 16),
], $this->adminId, $this->adminInfo));
// Preserve raw JSON type and exact enum, including null/whitespace rejection.
'channel_roles' => array_key_exists('channel_roles', $p) ? $p['channel_roles'] : 'unconfirmed',
], $this->adminId, $this->adminInfo), true);
}
public function lists()
@@ -49,6 +49,7 @@ final class FollowupAudioLogic
public static function create(array $p, int $actor, array $info): array
{
$channelRoles = Store::validateChannelRoles(array_key_exists('channel_roles', $p) ? $p['channel_roles'] : 'unconfirmed');
self::requireEnabled(true);
Access::diagnosis($p['diagnosis_id'], $actor, $info);
$upload = Upload::owned($p['upload_id'], $actor, $info);
@@ -63,7 +64,7 @@ final class FollowupAudioLogic
if (!in_array($p['model_key'], ['qwen', 'openai'], true) || !Store::ready($p['model_key'])) {
throw new DomainException('所选模型音频能力尚未验证');
}
return Store::create($upload, $p['recorded_at'], $p['model_key'], $actor, $info);
return Store::create($upload, $p['recorded_at'], $p['model_key'], $actor, $info, $channelRoles);
}
public static function lists(int $diagnosisId, int $actor, array $info): array