Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🔨 chore: sync some small fix changes form cloud (#9875)

YuTengjing932ceb218bee
diff --git a/src/features/ChatItem/components/ErrorContent.tsx b/src/features/ChatItem/components/ErrorContent.tsx
index ade2397df51..5d91bee124c 100644
--- a/src/features/ChatItem/components/ErrorContent.tsx
+++ b/src/features/ChatItem/components/ErrorContent.tsx
@@ -14,6 +14,11 @@ export interface ErrorContentProps {
const ErrorContent = memo<ErrorContentProps>(({ message, error, placement }) => {
const { styles } = useStyles({ placement });
+ if (!error?.message) {
+ if (!message) return null;
+ return <Flexbox className={styles.errorContainer}>{message}</Flexbox>;
+ }
+
return (
<Flexbox className={styles.errorContainer}>
<Alert closable={false} extra={message} showIcon type={'error'} {...error} />
diff --git a/src/features/Conversation/Error/style.tsx b/src/features/Conversation/Error/style.tsx
index 5223fb95dea..f1d59f89e1c 100644
--- a/src/features/Conversation/Error/style.tsx
+++ b/src/features/Conversation/Error/style.tsx
@@ -16,7 +16,11 @@ export const useStyles = createStyles(({ css, token }) => ({
`,
form: css`
width: 100%;
- max-width: 300px;
+ max-width: 360px;
+
+ @media (max-width: 768px) {
+ max-width: 90%;
+ }
`,
}));
diff --git a/src/store/image/slices/createImage/action.test.ts b/src/store/image/slices/createImage/action.test.ts
index d8c8e165f47..8ba0e7eab43 100644
--- a/src/store/image/slices/createImage/action.test.ts
+++ b/src/store/image/slices/createImage/action.test.ts
@@ -54,6 +54,9 @@ describe('CreateImageAction', () => {
provider: 'batch-provider',
model: 'batch-model',
config: { prompt: 'batch prompt' },
+ generations: [{}, {}, {}, {}], // 4 generations to match expected imageNum
+ createdAt: new Date(),
+ prompt: 'batch prompt',
} as any,
],
},
@@ -280,6 +283,10 @@ describe('CreateImageAction', () => {
});
});
+ // Get batch to verify imageNum uses batch.generations.length
+ const batch = result.current.generationBatchesMap['active-topic-id']?.[0];
+ const expectedImageNum = batch?.generations.length ?? 0;
+
await act(async () => {
await result.current.recreateImage('batch-id');
});
@@ -290,12 +297,12 @@ describe('CreateImageAction', () => {
// Verify batch removal
expect(mockRemoveGenerationBatch).toHaveBeenCalledWith('batch-id', 'active-topic-id');
- // Verify service call
+ // Verify service call uses batch.generations.length for imageNum
expect(mockImageService.createImage).toHaveBeenCalledWith({
generationTopicId: 'active-topic-id',
provider: 'batch-provider',
model: 'batch-model',
- imageNum: 4,
+ imageNum: expectedImageNum,
params: { prompt: 'batch prompt' },
});
diff --git a/src/store/image/slices/createImage/action.ts b/src/store/image/slices/createImage/action.ts
index 02563aa3cd7..6cd4e2ca4cf 100644
--- a/src/store/image/slices/createImage/action.ts
+++ b/src/store/image/slices/createImage/action.ts
@@ -112,15 +112,17 @@ export const createCreateImageSlice: StateCreator<
set({ isCreating: true }, false, 'recreateImage/startCreateImage');
const store = get();
- const imageNum = imageGenerationConfigSelectors.imageNum(store);
const activeGenerationTopicId = generationTopicSelectors.activeGenerationTopicId(store);
- const batch = generationBatchSelectors.getGenerationBatchByBatchId(generationBatchId)(store)!;
- const { removeGenerationBatch } = store;
-
if (!activeGenerationTopicId) {
throw new Error('No active generation topic');
}
+ const { removeGenerationBatch } = store;
+ const batch = generationBatchSelectors.getGenerationBatchByBatchId(generationBatchId)(store)!;
+
+ // Use batch.generations.length to preserve original imageNum (not UI config)
+ const imageNum = batch.generations.length;
+
try {
// 1. Delete generation batch
await removeGenerationBatch(generationBatchId, activeGenerationTopicId);