fix(design): restore streamed replies and quote handoff
This commit is contained in:
1 parent
229b1b1ce3
commit
23f96a523e
9 files changed
+362
-19
No files matched your search
@@ -33,6 +33,7 @@ export type YouthCreationCardProps = {
|
||||
generationAvailable: boolean;
|
||||
onOpenFineTune: () => void;
|
||||
onFocusComposer: () => void;
|
||||
onQuoteOffered?: () => void;
|
||||
};
|
||||
|
||||
function formatDuration(seconds: number): string {
|
||||
@@ -335,19 +336,23 @@ export function YouthCreationCard({
|
||||
generationAvailable,
|
||||
onOpenFineTune,
|
||||
onFocusComposer,
|
||||
onQuoteOffered,
|
||||
}: YouthCreationCardProps) {
|
||||
const requestQuote = useImageWorkspaceStore((state) => state.requestQuote);
|
||||
const pendingOperations = useImageWorkspaceStore((state) => state.pendingOperations);
|
||||
const model = projectYouthCreationCard(workspace, { quoteBlockers });
|
||||
const requesting = Object.values(pendingOperations).some(
|
||||
(operation) => operation.status === 'submitting' && operation.command.kind === 'request_quote',
|
||||
(operation) => operation.command.kind === 'request_quote'
|
||||
&& operation.command.workspaceId === workspace.workspace.workspaceId,
|
||||
);
|
||||
|
||||
const request = () => {
|
||||
if (!generationAvailable || requesting || !model.canRequestQuote) return;
|
||||
void requestQuote().catch(() => {
|
||||
toast.error('制作方案还没准备好,请稍后再试');
|
||||
});
|
||||
void requestQuote()
|
||||
.then(() => onQuoteOffered?.())
|
||||
.catch(() => {
|
||||
toast.error('制作方案还没准备好,请稍后再试');
|
||||
});
|
||||
};
|
||||
const hasMoreDetails = model.mustInclude.length > 0
|
||||
|| model.mustPreserve.length > 0
|
||||
|
||||
Reference in new issue
Block a user