🐛 fix: fix image prompt form (#9995)

* 🐛 fix: do not create image on Enter key during composition

* 🐛 fix: include authorization header in mock user context
This commit is contained in:
Coooolfan
2025-11-02 23:12:53 +08:00
committed by GitHub
parent 838a7d4eed
commit 799e6fd0fd
2 changed files with 5 additions and 2 deletions

View File

@@ -73,7 +73,7 @@ const PromptInput = ({ showTitle = false }: PromptInputProps) => {
};
const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter' && !e.shiftKey) {
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
e.preventDefault();
if (!isCreating && value.trim()) {
handleGenerate();

View File

@@ -80,7 +80,10 @@ export const createLambdaContext = async (request: NextRequest): Promise<LambdaC
const isMockUser = process.env.ENABLE_MOCK_DEV_USER === '1';
if (process.env.NODE_ENV === 'development' && (isDebugApi || isMockUser)) {
return { userId: process.env.MOCK_DEV_USER_ID };
return {
authorizationHeader: request.headers.get(LOBE_CHAT_AUTH_HEADER),
userId: process.env.MOCK_DEV_USER_ID,
};
}
log('createLambdaContext called for request');