feat(chat): render role-bound payment guidance
Docker Image / Build and Push Docker Image (push) Successful in 5m2s
Docker Image / Build and Push Docker Image (push) Successful in 5m2s
This commit is contained in:
@@ -22,6 +22,7 @@ const showUnlockHistoryPromptAction = sendMachineSetup.assign(
|
||||
unlockHistoryPromptVisible: true,
|
||||
lockedHistoryCount: countLockedHistoryMessages(context.messages),
|
||||
unlockHistoryError: null,
|
||||
unlockHistoryPaymentGuidance: null,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -29,12 +30,14 @@ const dismissUnlockHistoryPromptAction = sendMachineSetup.assign(() => ({
|
||||
paymentUnlockPending: false,
|
||||
unlockHistoryPromptVisible: false,
|
||||
unlockHistoryError: null,
|
||||
unlockHistoryPaymentGuidance: null,
|
||||
}));
|
||||
|
||||
const markUnlockHistoryStartedAction = sendMachineSetup.assign(() => ({
|
||||
paymentUnlockPending: false,
|
||||
unlockHistoryPromptVisible: false,
|
||||
unlockHistoryError: null,
|
||||
unlockHistoryPaymentGuidance: null,
|
||||
}));
|
||||
|
||||
const markUnlockHistoryFailedAction = sendMachineSetup.assign(() => ({
|
||||
@@ -76,6 +79,7 @@ const applyUnlockMessageSucceededAction = sendMachineSetup.assign(
|
||||
creditsCharged: output.response.creditsCharged,
|
||||
requiredCredits: 0,
|
||||
shortfallCredits: 0,
|
||||
paymentGuidance: null,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -112,11 +116,15 @@ const requestUnlockPaymentFromOutputAction = sendMachineSetup.assign(
|
||||
creditBalance: output.response.creditBalance,
|
||||
requiredCredits: output.response.requiredCredits,
|
||||
shortfallCredits: output.response.shortfallCredits,
|
||||
...(output.response.paymentGuidance
|
||||
? { paymentGuidance: output.response.paymentGuidance }
|
||||
: {}),
|
||||
}
|
||||
: null,
|
||||
creditBalance: output.response.creditBalance,
|
||||
requiredCredits: output.response.requiredCredits,
|
||||
shortfallCredits: output.response.shortfallCredits,
|
||||
paymentGuidance: output.response.paymentGuidance,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -191,6 +199,9 @@ const applyUnlockHistoryOutputAction =
|
||||
unlockHistoryError: insufficientBalance
|
||||
? `Insufficient credits. You still need ${event.output.shortfallCredits} credits.`
|
||||
: null,
|
||||
unlockHistoryPaymentGuidance: insufficientBalance
|
||||
? event.output.paymentGuidance ?? null
|
||||
: null,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user