MCPcopy
hub / github.com/HisMax/RedInk / retrySingleImage

Function retrySingleImage

frontend/src/composables/useImageRetry.ts:24–59  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

22 }
23
24 function retrySingleImage(index: number) {
25 if (!store.taskId || regeneratingIndices.value.has(index)) return
26
27 const page = store.outline.pages.find(p => p.index === index)
28 if (!page) return
29
30 regeneratingIndices.value.add(index)
31 store.setImageRetrying(index)
32
33 const context = {
34 fullOutline: store.outline.raw || '',
35 userTopic: store.topic || '',
36 recordId: store.recordId
37 }
38
39 apiRegenerateImage(store.taskId, page, true, context)
40 .then(result => {
41 if (result.success && result.image_url) {
42 store.updateImage(index, result.image_url)
43 finishIfAllImagesDone()
44 } else {
45 store.updateProgress(
46 index,
47 'error',
48 undefined,
49 formatErrorMessage(result.error || result.error_message || '重绘失败', '重绘失败')
50 )
51 }
52 })
53 .catch(e => {
54 store.updateProgress(index, 'error', undefined, formatErrorMessage(e, '重绘失败'))
55 })
56 .finally(() => {
57 regeneratingIndices.value.delete(index)
58 })
59 }
60
61 function regenerateImage(index: number) {
62 retrySingleImage(index)

Callers 1

regenerateImageFunction · 0.85

Calls 2

formatErrorMessageFunction · 0.90
finishIfAllImagesDoneFunction · 0.85

Tested by

no test coverage detected