Finetune text debug drawer
This commit is contained in:
@@ -1275,10 +1275,13 @@ export const DebugDrawer: React.FC<{
|
||||
const handleTextLaunch = async () => {
|
||||
try {
|
||||
setWsError('');
|
||||
// Start every text debug run as a fresh session transcript.
|
||||
setMessages([]);
|
||||
assistantDraftIndexRef.current = null;
|
||||
if (textTtsEnabled) await ensureAudioContext();
|
||||
await ensureWsSession();
|
||||
setTextSessionStarted(true);
|
||||
setMessages((prev) => (prev.length > 0 ? prev : [{ role: 'model', text: assistant.opener || 'Hello!' }]));
|
||||
setMessages([{ role: 'model', text: assistant.opener || 'Hello!' }]);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setWsStatus('error');
|
||||
@@ -1801,7 +1804,7 @@ export const DebugDrawer: React.FC<{
|
||||
</div>
|
||||
|
||||
<div className="shrink-0 space-y-2">
|
||||
<div className="flex space-x-2">
|
||||
<div className="flex items-center gap-2 min-w-0">
|
||||
{mode === 'text' && textSessionStarted && (
|
||||
<Button variant="destructive" size="sm" className="h-9 font-bold shrink-0" onClick={closeWs}>
|
||||
<PhoneOff className="mr-2 h-4 w-4" /> 结束测试
|
||||
@@ -1813,9 +1816,9 @@ export const DebugDrawer: React.FC<{
|
||||
placeholder={mode === 'text' && !textSessionStarted ? "请先发起呼叫后输入消息..." : (mode === 'text' ? "输入消息..." : "输入文本模拟交互...")}
|
||||
onKeyDown={e => e.key === 'Enter' && handleSend()}
|
||||
disabled={isLoading || (mode === 'text' ? !textSessionStarted : callStatus !== 'active')}
|
||||
className="flex-1"
|
||||
className="flex-1 min-w-0"
|
||||
/>
|
||||
<Button size="icon" onClick={handleSend} disabled={isLoading || (mode === 'text' ? !textSessionStarted : callStatus !== 'active')}><Send className="h-4 w-4" /></Button>
|
||||
<Button size="icon" className="shrink-0" onClick={handleSend} disabled={isLoading || (mode === 'text' ? !textSessionStarted : callStatus !== 'active')}><Send className="h-4 w-4" /></Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user