Skip to content

Commit 799e6fd

Browse files
authored
🐛 fix: fix image prompt form (lobehub#9995)
* 🐛 fix: do not create image on Enter key during composition * 🐛 fix: include authorization header in mock user context
1 parent 838a7d4 commit 799e6fd

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/app/[variants]/(main)/image/features/PromptInput/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const PromptInput = ({ showTitle = false }: PromptInputProps) => {
7373
};
7474

7575
const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {
76-
if (e.key === 'Enter' && !e.shiftKey) {
76+
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
7777
e.preventDefault();
7878
if (!isCreating && value.trim()) {
7979
handleGenerate();

src/libs/trpc/lambda/context.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ export const createLambdaContext = async (request: NextRequest): Promise<LambdaC
8080
const isMockUser = process.env.ENABLE_MOCK_DEV_USER === '1';
8181

8282
if (process.env.NODE_ENV === 'development' && (isDebugApi || isMockUser)) {
83-
return { userId: process.env.MOCK_DEV_USER_ID };
83+
return {
84+
authorizationHeader: request.headers.get(LOBE_CHAT_AUTH_HEADER),
85+
userId: process.env.MOCK_DEV_USER_ID,
86+
};
8487
}
8588

8689
log('createLambdaContext called for request');

0 commit comments

Comments
 (0)