测试多任务暂存
This commit is contained in:
6
app/.env
6
app/.env
@@ -6,10 +6,12 @@ mysql_user=aiimage
|
|||||||
proxy_url=https://api.jikip.com/ip-get?num=1&minute=1&format=json&area=all&protocol=1&mode=2&key=t24g6gi44ubufd8
|
proxy_url=https://api.jikip.com/ip-get?num=1&minute=1&format=json&area=all&protocol=1&mode=2&key=t24g6gi44ubufd8
|
||||||
proxy_mode=2
|
proxy_mode=2
|
||||||
|
|
||||||
|
zn_company=rongchuang123
|
||||||
|
zn_username=%E8%87%AA%E5%8A%A8%E5%8C%96_Robot
|
||||||
|
|
||||||
client_name=ShuFuAI
|
client_name=ShuFuAI
|
||||||
|
|
||||||
|
|
||||||
java_api_base=http://127.0.0.1:18080
|
java_api_base=http://8.136.19.173:18080
|
||||||
# java_api_base=http://8.136.19.173:18080
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
15
app/.env copy
Normal file
15
app/.env copy
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
base_url=http://8.136.19.173:15124
|
||||||
|
workflow_id=7608812635877900322
|
||||||
|
mysql_host=8.136.19.173
|
||||||
|
mysql_user=aiimage
|
||||||
|
|
||||||
|
proxy_url=https://api.jikip.com/ip-get?num=1&minute=1&format=json&area=all&protocol=1&mode=2&key=t24g6gi44ubufd8
|
||||||
|
proxy_mode=2
|
||||||
|
|
||||||
|
client_name=ShuFuAI
|
||||||
|
|
||||||
|
|
||||||
|
java_api_base=http://127.0.0.1:18080
|
||||||
|
# java_api_base=http://8.136.19.173:18080
|
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
BIN
app/amazon/__pycache__/del_brand.cpython-312.pyc
Normal file
BIN
app/amazon/__pycache__/del_brand.cpython-312.pyc
Normal file
Binary file not shown.
BIN
app/amazon/__pycache__/main.cpython-312.pyc
Normal file
BIN
app/amazon/__pycache__/main.cpython-312.pyc
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,7 @@
|
|||||||
<script type="module" crossorigin src="/assets/delete-brand.js"></script>
|
<script type="module" crossorigin src="/assets/delete-brand.js"></script>
|
||||||
<link rel="modulepreload" crossorigin href="/assets/pywebview-Dee3nQjE.js">
|
<link rel="modulepreload" crossorigin href="/assets/pywebview-Dee3nQjE.js">
|
||||||
<link rel="stylesheet" crossorigin href="/assets/pywebview-MkjZQlBu.css">
|
<link rel="stylesheet" crossorigin href="/assets/pywebview-MkjZQlBu.css">
|
||||||
<link rel="stylesheet" crossorigin href="/assets/delete-brand-CS44Bk-y.css">
|
<link rel="stylesheet" crossorigin href="/assets/delete-brand-D9tUv360.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version": "1.0.22"}
|
{"version": "1.0.13"}
|
||||||
@@ -417,7 +417,35 @@ function getDisplayError(item: DeleteBrandResultItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function shouldShowProgress(item: DeleteBrandResultItem) {
|
function shouldShowProgress(item: DeleteBrandResultItem) {
|
||||||
|
const taskId = item.taskId
|
||||||
|
if (!taskId) return false
|
||||||
|
|
||||||
|
const progress = taskDetails.value[taskId]?.line_progress
|
||||||
|
const multiFileTask = isMultiFileTask(taskId)
|
||||||
const qs = getQueueStatus(item)
|
const qs = getQueueStatus(item)
|
||||||
|
|
||||||
|
// 已完成/终态后隐藏进度条。
|
||||||
|
if (qs === '本文件解析完毕' || qs === '已被全局判定为终态') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (multiFileTask) {
|
||||||
|
const sessionItem = findSessionItem(taskId, item)
|
||||||
|
// 多文件任务:未入队的文件不展示同一个 task 的公共进度,避免“两个文件同时在跑”的错觉。
|
||||||
|
if (!sessionItem?._pushed) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (progress?.has_progress && progress?.info?.file_name) {
|
||||||
|
return progress.info.file_name === item.sourceFilename
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (progress?.has_progress || progress?.info) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return qs === '已入队' || qs === '处理中'
|
return qs === '已入队' || qs === '处理中'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,14 +578,20 @@ function getQueueStatus(item: DeleteBrandResultItem) {
|
|||||||
return '已被全局判定为终态'
|
return '已被全局判定为终态'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status === 'RUNNING' && info?.has_progress && info?.info?.file_name === item.sourceFilename) {
|
// 多文件:未推送的文件必须保持“未入队”,避免被同 task 的公共 RUNNING 状态误判成“处理中”。
|
||||||
return '处理中'
|
if (multiFileTask && !sessionItem?._pushed && !sessionItem?._completed) {
|
||||||
|
return '未入队'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 先看前端会话态:一旦该文件已判定完成,优先展示完成,避免被 RUNNING 覆盖导致链式推进卡住。
|
||||||
if (sessionItem?._completed) {
|
if (sessionItem?._completed) {
|
||||||
return '本文件解析完毕'
|
return '本文件解析完毕'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status === 'RUNNING' && info?.has_progress && info?.info?.file_name === item.sourceFilename) {
|
||||||
|
return '处理中'
|
||||||
|
}
|
||||||
|
|
||||||
if (multiFileTask && status === 'SUCCESS') {
|
if (multiFileTask && status === 'SUCCESS') {
|
||||||
return '本文件解析完毕'
|
return '本文件解析完毕'
|
||||||
}
|
}
|
||||||
@@ -916,6 +950,11 @@ function formatPreview(rows: DeleteBrandPreviewRow[]) {
|
|||||||
return hiddenCount > 0 ? `${preview.join('、')} 等 ${rows.length} 条` : preview.join('、')
|
return hiddenCount > 0 ? `${preview.join('、')} 等 ${rows.length} 条` : preview.join('、')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function debugAutoAdvance(step: string, payload?: Record<string, unknown>) {
|
||||||
|
if (!import.meta.env.DEV) return
|
||||||
|
console.log(`[DeleteBrandAutoAdvance] ${step}`, payload || {})
|
||||||
|
}
|
||||||
|
|
||||||
function isPythonQueueBusy() {
|
function isPythonQueueBusy() {
|
||||||
for (const task of sessionTasks.value) {
|
for (const task of sessionTasks.value) {
|
||||||
for (const item of task.items) {
|
for (const item of task.items) {
|
||||||
@@ -945,6 +984,11 @@ function findNextAutoRunnableItem() {
|
|||||||
|
|
||||||
async function runItem(item: DeleteBrandResultItem, options?: { auto?: boolean }) {
|
async function runItem(item: DeleteBrandResultItem, options?: { auto?: boolean }) {
|
||||||
if (options?.auto && isPythonQueueBusy()) {
|
if (options?.auto && isPythonQueueBusy()) {
|
||||||
|
debugAutoAdvance('runItem blocked by busy queue', {
|
||||||
|
mode: 'auto',
|
||||||
|
taskId: item.taskId,
|
||||||
|
sourceFilename: item.sourceFilename,
|
||||||
|
})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -992,8 +1036,17 @@ async function runItem(item: DeleteBrandResultItem, options?: { auto?: boolean }
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function maybeAutoAdvance() {
|
async function maybeAutoAdvance() {
|
||||||
if (!chainStarted.value || autoAdvancing.value) return
|
if (!chainStarted.value || autoAdvancing.value) {
|
||||||
if (isPythonQueueBusy()) return
|
debugAutoAdvance('skip: chain not started or auto advancing', {
|
||||||
|
chainStarted: chainStarted.value,
|
||||||
|
autoAdvancing: autoAdvancing.value,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (isPythonQueueBusy()) {
|
||||||
|
debugAutoAdvance('skip: queue busy')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const currentKey = activeItemKey.value
|
const currentKey = activeItemKey.value
|
||||||
if (currentKey) {
|
if (currentKey) {
|
||||||
@@ -1002,15 +1055,33 @@ async function maybeAutoAdvance() {
|
|||||||
const taskId = currentItem.taskId
|
const taskId = currentItem.taskId
|
||||||
const multiFileTask = isMultiFileTask(taskId)
|
const multiFileTask = isMultiFileTask(taskId)
|
||||||
if (multiFileTask) {
|
if (multiFileTask) {
|
||||||
updateCompletedItemsFromProgress(taskId)
|
const changed = updateCompletedItemsFromProgress(taskId)
|
||||||
|
debugAutoAdvance('sync completed from progress', {
|
||||||
|
taskId,
|
||||||
|
changed,
|
||||||
|
status: getQueueStatus(currentItem),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const status = getQueueStatus(currentItem)
|
const status = getQueueStatus(currentItem)
|
||||||
if (status === '已入队' || status === '处理中') {
|
if (status === '已入队' || status === '处理中') {
|
||||||
|
debugAutoAdvance('skip: current item still running', {
|
||||||
|
currentKey,
|
||||||
|
status,
|
||||||
|
taskId,
|
||||||
|
sourceFilename: currentItem.sourceFilename,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (multiFileTask) {
|
if (multiFileTask) {
|
||||||
const sessionItem = findSessionItem(taskId, currentItem)
|
const sessionItem = findSessionItem(taskId, currentItem)
|
||||||
if (sessionItem && !sessionItem._completed) {
|
if (sessionItem && !sessionItem._completed) {
|
||||||
|
debugAutoAdvance('skip: multi-file current not completed yet', {
|
||||||
|
currentKey,
|
||||||
|
taskId,
|
||||||
|
sourceFilename: currentItem.sourceFilename,
|
||||||
|
pushed: sessionItem._pushed,
|
||||||
|
completed: sessionItem._completed,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1019,6 +1090,9 @@ async function maybeAutoAdvance() {
|
|||||||
|
|
||||||
const nextItem = findNextAutoRunnableItem()
|
const nextItem = findNextAutoRunnableItem()
|
||||||
if (!nextItem) {
|
if (!nextItem) {
|
||||||
|
debugAutoAdvance('stop chain: no next runnable item', {
|
||||||
|
currentKey,
|
||||||
|
})
|
||||||
activeItemKey.value = ''
|
activeItemKey.value = ''
|
||||||
chainStarted.value = false
|
chainStarted.value = false
|
||||||
return
|
return
|
||||||
@@ -1026,8 +1100,17 @@ async function maybeAutoAdvance() {
|
|||||||
|
|
||||||
autoAdvancing.value = true
|
autoAdvancing.value = true
|
||||||
try {
|
try {
|
||||||
|
debugAutoAdvance('try start next item', {
|
||||||
|
taskId: nextItem.taskId,
|
||||||
|
sourceFilename: nextItem.sourceFilename,
|
||||||
|
nextKey: getItemKey(nextItem),
|
||||||
|
})
|
||||||
const started = await runItem(nextItem, { auto: true })
|
const started = await runItem(nextItem, { auto: true })
|
||||||
if (!started) {
|
if (!started) {
|
||||||
|
debugAutoAdvance('stop chain: runItem returned false', {
|
||||||
|
taskId: nextItem.taskId,
|
||||||
|
sourceFilename: nextItem.sourceFilename,
|
||||||
|
})
|
||||||
chainStarted.value = false
|
chainStarted.value = false
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user