Integrate reviewed full action pack admission and bounded idle scheduling
This commit is contained in:
+4
-1
@@ -18,6 +18,7 @@ def avatarNatural = providers.gradleProperty('avatarNatural').orNull == 'true'
|
||||
def avatarUiCandidate = providers.gradleProperty('avatarUiCandidate').orNull == 'true'
|
||||
def avatarMouthCandidate = providers.gradleProperty('avatarMouthCandidate').orNull == 'true'
|
||||
def avatarActionCandidate = providers.gradleProperty('avatarActionCandidate').orNull == 'true'
|
||||
def avatarFullActionCandidate = providers.gradleProperty('avatarFullActionCandidate').orNull == 'true'
|
||||
def actionVersionCode = (providers.gradleProperty('actionVersionCode').orNull ?: '16').toInteger()
|
||||
if (avatarActionCandidate && (!avatarMouthCandidate || actionVersionCode < 16)) {
|
||||
throw new GradleException('Action stage requires the existing mouth runtime and a fresh code >=16')
|
||||
@@ -32,6 +33,7 @@ def naturalManifestSha = providers.gradleProperty('naturalManifestSha').orNull ?
|
||||
def emotionManifestSha = providers.gradleProperty('emotionManifestSha').orNull ?: ''
|
||||
if (emotionManifestSha && !(emotionManifestSha ==~ /[0-9a-f]{64}/)) throw new GradleException('Emotion graph requires exact external manifest SHA')
|
||||
if (emotionManifestSha && (!avatarActionCandidate || !avatarMouthCandidate || !avatarNatural || actionVersionCode < 17)) throw new GradleException('Emotion candidate requires own-mouth runtime and a fresh code >=17')
|
||||
if (avatarFullActionCandidate && (!emotionManifestSha || !avatarActionCandidate || actionVersionCode < 18)) throw new GradleException('Full candidate requires pinned emotion/action graph and fresh code >=18')
|
||||
if (avatarNatural && !(naturalManifestSha ==~ /[0-9a-f]{64}/)) {
|
||||
throw new GradleException('Natural debug candidate requires exact runtime manifest SHA')
|
||||
}
|
||||
@@ -88,7 +90,8 @@ android {
|
||||
buildFeatures { compose true; buildConfig true }
|
||||
buildTypes {
|
||||
debug {
|
||||
if (emotionManifestSha) versionNameSuffix '-emotion-dev'
|
||||
if (avatarFullActionCandidate) { /* Full reviewed debug integration candidate: 0.7.0 */ }
|
||||
else if (emotionManifestSha) versionNameSuffix '-emotion-dev'
|
||||
else if (avatarActionCandidate) versionNameSuffix '-stage-dev'
|
||||
else if (avatarMouthCandidate) versionNameSuffix '-mouth-dev'
|
||||
else if (avatarUiCandidate) versionNameSuffix '-ui-dev'
|
||||
|
||||
@@ -46,7 +46,10 @@ class ActionController(
|
||||
val valid = capability
|
||||
if (active || valid == null || next.packSha != valid.manifestSha || next.id.length !in 16..64 ||
|
||||
next.turn !in 0..0xffff_ffffL || next.ttlMs !in 1..120_000) return false
|
||||
val candidates = valid.assets.filter { it.id != previous }
|
||||
// Prefer a different variant 3:1, while two assets still remain random rather
|
||||
// than a forced alternating playlist. The model chooses dance, never a variant.
|
||||
val different=valid.assets.filter { it.id != previous }
|
||||
val candidates = if(previous==null) valid.assets else different+different+different+valid.assets.filter { it.id==previous }
|
||||
val asset = candidates[choose(candidates.size)]
|
||||
val fence = ++generation
|
||||
plan = next; deadline = clock()+next.ttlMs; changed(true)
|
||||
|
||||
@@ -131,6 +131,7 @@ fun CallScreen(state: VoiceUiState,entry: EntryPhase,permissionMessage: String?,
|
||||
val visualEmotion=pack?.emotionAction?.visuals?.firstOrNull { it.id==visualId }?.emotion
|
||||
Text("当前画面:${visualEmotion?.label ?: if(pack?.emotionAction!=null) "过渡或未呈现" else "中立"} · ${video.actual}",fontSize=12.sp)
|
||||
Text("视觉选择:${mediaBinding?.selection?.let { "${it.visualEmotion.wire}/${it.visualIntensity}" } ?: "未选择"} · ${mediaBinding?.visualStatus ?: "旧中立素材"}",fontSize=12.sp)
|
||||
if(pack?.emotionAction!=null) Text("整合候选 · 动态自然度、音乐听审及真机未测;表达可能等待 2–4 秒出口和约 1 秒过渡",fontSize=12.sp)
|
||||
AvatarDiagnostics(pack,video)
|
||||
Text("AEC:${state.aec.name} · 效果待真机验证",fontSize=12.sp)
|
||||
Row {
|
||||
@@ -214,6 +215,7 @@ fun EngineeringPreviewScreen(pack: AvatarPack?,micGranted: Boolean,cameraGranted
|
||||
Text("可手动申请权限;授权后仍不启动采集",fontSize=12.sp)
|
||||
PermissionSettings(micGranted,cameraGranted,micSettings,cameraSettings,permissionPending,onAuthorizeMic,onAuthorizeCamera)
|
||||
Text("合成意图:${override?.name ?: if(pack?.emotionAction!=null) emotionLabel else trace.label}",fontSize=12.sp)
|
||||
if(pack?.emotionAction!=null) Text("整合候选 · 动态自然度、音乐听审及真机未测;表达可能等待 2–4 秒出口和约 1 秒过渡",fontSize=12.sp)
|
||||
AvatarDiagnostics(pack,video)
|
||||
Row(horizontalArrangement=Arrangement.spacedBy(8.dp)) {
|
||||
TextButton(onClick={override=AvatarMode.IDLE}) { Text("Idle") }
|
||||
|
||||
@@ -26,7 +26,8 @@ class ConversationMediaDriver(private val index: EmotionActionIndex,
|
||||
private val create: (Int)->CompositeMediaPort,private val music: MusicMediaPort,
|
||||
private val reveal: (Int?)->Unit,private val report: (String,BodyFrameKey?)->Unit = { _,_-> },
|
||||
private val allowSilentEdges: Boolean=false,
|
||||
private val chooseIdle: (Int)->Int = { kotlin.random.Random.nextInt(it) }) : ActionPlayer {
|
||||
private val chooseIdle: (Int)->Int = { kotlin.random.Random.nextInt(it) },
|
||||
private val chooseIdleCycles: ()->Int = { kotlin.random.Random.nextInt(2,4) }) : ActionPlayer {
|
||||
private data class Slot(val number: Int,val port: CompositeMediaPort,val pack: ContinuousAvatarPack,
|
||||
val entry: Int,val packageId: String?,var key: BodyFrameKey?=null,var live: Boolean=true,var closedMouth: Boolean=false)
|
||||
private val slots=mutableListOf<Slot>()
|
||||
@@ -38,6 +39,9 @@ class ConversationMediaDriver(private val index: EmotionActionIndex,
|
||||
private var selectedId=index.fallbackId
|
||||
private var idleTarget: String?=null
|
||||
private var lastIdle: String?=null
|
||||
private var idleCycles=0
|
||||
private var idleCycleGoal=chooseIdleCycles().also { check(it in 2..3) }
|
||||
private fun resetIdleCycles() { idleCycles=0;idleCycleGoal=chooseIdleCycles().also { check(it in 2..3) } }
|
||||
var selection: RoleVisualSelection?=null;private set
|
||||
val currentPackageId: String? get() = if(inBridge || actionStarted) null else visible?.packageId
|
||||
val visualStatus: String get() = when {
|
||||
@@ -67,14 +71,14 @@ class ConversationMediaDriver(private val index: EmotionActionIndex,
|
||||
private val releaseWaiters=mutableListOf<()->Unit>()
|
||||
fun beginTurn(id: Long?) {
|
||||
if(id==turn) return
|
||||
turn=id;seq=-1;generation++;revision=0;talk=false;selection=null;idleTarget=null
|
||||
turn=id;seq=-1;generation++;revision=0;talk=false;selection=null;idleTarget=null;resetIdleCycles()
|
||||
selectedId=visible?.packageId ?: index.fallbackId
|
||||
if(!inBridge && revealing==null) discardRoute()
|
||||
applyMouth()
|
||||
}
|
||||
fun start() {
|
||||
if(active || closing!=0) return
|
||||
active=true;generation++;revision=0
|
||||
active=true;generation++;revision=0;resetIdleCycles()
|
||||
val slot=prepare(index.fallbackId,0);visible=slot
|
||||
// Ports must deliver callbacks asynchronously, like both Android ports.
|
||||
}
|
||||
@@ -94,10 +98,10 @@ class ConversationMediaDriver(private val index: EmotionActionIndex,
|
||||
seq=reply.sequence
|
||||
selection=RoleVisualSelector.select(reply.emotion,reply.intensity,index.visuals,index.fallbackId)
|
||||
selectedId=checkNotNull(selection).packageId
|
||||
idleTarget=null
|
||||
idleTarget=null;resetIdleCycles()
|
||||
}
|
||||
talk=talking && reply?.turnId==turn
|
||||
if(talk) idleTarget=null
|
||||
if(talk) { idleTarget=null;idleCycles=0 }
|
||||
applyMouth()
|
||||
if(active && !inBridge && !actionStarted) plan()
|
||||
}
|
||||
@@ -143,6 +147,9 @@ class ConversationMediaDriver(private val index: EmotionActionIndex,
|
||||
key==previous || key.index!=slot.pack.body.frameCount-1 ||
|
||||
selection?.visualEmotion?.let { it!=com.gorios.lanvoice.dialogue.RoleEmotion.NEUTRAL }==true ||
|
||||
index.visuals.none { it.id==slot.packageId && it.emotion==com.gorios.lanvoice.dialogue.RoleEmotion.NEUTRAL }) return
|
||||
idleCycles++
|
||||
if(idleCycles<idleCycleGoal) return
|
||||
resetIdleCycles()
|
||||
if(idleTarget!=null && slot.packageId==idleTarget && slot.packageId!=index.fallbackId) {
|
||||
idleTarget=index.fallbackId;report("idle_variant_return_queued",key);return
|
||||
}
|
||||
@@ -231,7 +238,7 @@ class ConversationMediaDriver(private val index: EmotionActionIndex,
|
||||
override fun play(asset: ActionAsset,finished: (ActionEnd)->Unit,failed: ()->Unit) {
|
||||
val media=asset.media
|
||||
if(!active || action!=null || media==null || index.actionPack?.assets?.contains(asset)!=true) { failed();return }
|
||||
action=asset;actionFinished=finished;actionFailed=failed;musicReady=false;talk=false;idleTarget=null;applyMouth()
|
||||
action=asset;actionFinished=finished;actionFailed=failed;musicReady=false;talk=false;idleTarget=null;resetIdleCycles();applyMouth()
|
||||
val epoch=++musicEpoch
|
||||
music.prepare(media,{ if(active && epoch==musicEpoch && action==asset) { musicReady=true;plan() } },
|
||||
{ if(active && epoch==musicEpoch && actionStarted) reveal(3) },{
|
||||
|
||||
Reference in New Issue
Block a user