Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,33 @@ export function clearSessionDraft( sessionId: string | undefined ): void {
saveDraft( getDraftStorageKey( sessionId ), '' );
}

function getIdlePlaceholderOptions(): string[] {
return [
__( 'What should we make better?' ),
__( 'What’s the next move?' ),
__( 'Tell me what to change next…' ),
__( 'Drop the next idea here…' ),
__( 'What are we tuning now?' ),
];
}

/**
* Pick a placeholder for the session. The choice is derived from the session id
* so it stays stable for the lifetime of a chat instead of changing on every
* render, while still varying between chats.
*/
function getSessionPlaceholder( sessionId: string | undefined ): string {
const options = getIdlePlaceholderOptions();
if ( ! sessionId ) {
return options[ 0 ];
}
let hash = 0;
for ( let i = 0; i < sessionId.length; i++ ) {
hash = ( hash * 31 + sessionId.charCodeAt( i ) ) | 0;
}
return options[ Math.abs( hash ) % options.length ];
}

export function Composer( {
busy,
isInterrupting = false,
Expand Down Expand Up @@ -410,7 +437,7 @@ export function Composer( {
const canSend = value.trim().length > 0 || attachments.length > 0;
const placeholder = busy
? __( 'Queue a follow-up instruction…' )
: __( 'Set your next instruction…' );
: getSessionPlaceholder( sessionId );
const sendAriaLabel = busy ? __( 'Queue' ) : __( 'Send' );
const modKey = isMacPlatform ? '⌘' : 'Ctrl';
const hoveredAttachment = hoverPreview
Expand Down
Loading