Goose Simple Compact UX (#4202)

Co-authored-by: David Katz <dkatz@squareup.com>
This commit is contained in:
Alex Hancock
2025-08-26 18:12:02 -04:00
committed by GitHub
parent a3097f5250
commit a4fc5ec4f1
27 changed files with 2608 additions and 1127 deletions
+2 -34
View File
@@ -347,40 +347,8 @@ export function useMessageStream({
}
case 'Error': {
// Check if this is a token limit error (more specific detection)
const errorMessage = parsedEvent.error;
const isTokenLimitError =
errorMessage &&
((errorMessage.toLowerCase().includes('token') &&
errorMessage.toLowerCase().includes('limit')) ||
(errorMessage.toLowerCase().includes('context') &&
errorMessage.toLowerCase().includes('length') &&
errorMessage.toLowerCase().includes('exceeded')));
// If this is a token limit error, create a contextLengthExceeded message instead of throwing
if (isTokenLimitError) {
const contextMessage: Message = {
id: generateMessageId(),
role: 'assistant',
created: Math.floor(Date.now() / 1000),
content: [
{
type: 'contextLengthExceeded',
msg: errorMessage,
},
],
display: true,
sendToLLM: false,
};
currentMessages = [...currentMessages, contextMessage];
mutate(currentMessages, false);
// Clear any existing error state since we handled this as a context message
setError(undefined);
break; // Don't throw error, just add the message
}
// Always throw the error so it gets caught and sets the error state
// This ensures the retry UI appears for ALL errors
throw new Error(parsedEvent.error);
}