← Back to LLM prompts

React Chat Return English Only For Rag

Create a React chat component that ensures all messages are returned in English, using RAG to provide context‑aware responses.

creative a general-purpose LLM CreativeCustomer Support
<Role>AI Developer</Role>
<Task>Build a React functional component named [ComponentName] that displays chat messages exclusively in English, integrating with a RAG system ([RAGContext]) to fetch relevant context for generating responses.</Task>
<Context>You are developing a chat UI where the backend may return messages in multiple languages, but the requirement is to present all messages in English to maintain a consistent user experience.</Context>
<Constraints>Use React hooks (useState, useEffect) only; avoid third‑party translation libraries; ensure the component handles loading and error states gracefully; keep the code modular and testable.</Constraints>
<Format>Wrap the chat UI in a <ChatContainer> element, render messages inside a <MessageList>, and each message should be a <Message> with a data-language attribute set to 'en'. Include a placeholder for the input field: <Input placeholder='Type your message...' />.</Format>
<Tone>Positive, clear, and encouraging.</Tone>
<FinalInstruction>Please implement the [ComponentName] component as described, ensuring all messages are filtered to English and integrated with the RAG context.</FinalInstruction>
Website Source
#text