mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-10 09:39:06 +00:00
* fix(web-shell): improve disconnected composer handling * fix(web-shell): keep disconnected placeholder unchanged --------- Co-authored-by: ytahdn <ytahdn@gmail.com>
40 lines
979 B
TypeScript
40 lines
979 B
TypeScript
type ComposerConnectionStatus =
|
|
| 'idle'
|
|
| 'connecting'
|
|
| 'connected'
|
|
| 'disconnected'
|
|
| 'error';
|
|
|
|
export function shouldDisableComposerInput({
|
|
catchingUp,
|
|
pendingApproval,
|
|
isPreparingPrompt,
|
|
}: {
|
|
catchingUp: boolean;
|
|
pendingApproval: boolean;
|
|
isPreparingPrompt: boolean;
|
|
}): boolean {
|
|
return Boolean(catchingUp || pendingApproval || isPreparingPrompt);
|
|
}
|
|
|
|
export function getComposerPlaceholderKey({
|
|
catchingUp,
|
|
isPreparingPrompt,
|
|
isStreaming,
|
|
}: {
|
|
catchingUp: boolean;
|
|
isPreparingPrompt: boolean;
|
|
isStreaming: boolean;
|
|
}): 'common.loading' | 'editor.processing' | 'editor.placeholder' {
|
|
if (catchingUp) return 'common.loading';
|
|
if (isPreparingPrompt || isStreaming) return 'editor.processing';
|
|
return 'editor.placeholder';
|
|
}
|
|
|
|
export function shouldBlockComposerSubmit({
|
|
connectionStatus,
|
|
}: {
|
|
connectionStatus: ComposerConnectionStatus;
|
|
}): boolean {
|
|
return connectionStatus === 'disconnected' || connectionStatus === 'error';
|
|
}
|