style: 优化部分按钮并统一部分颜色
This commit is contained in:
parent
1700628624
commit
3e6b3b2b6e
@ -407,12 +407,14 @@ async def rechunks_documents(
|
|||||||
error_type = "timeout" if isinstance(doc_error, TimeoutError) else "processing_error"
|
error_type = "timeout" if isinstance(doc_error, TimeoutError) else "processing_error"
|
||||||
error_msg = "处理超时" if isinstance(doc_error, TimeoutError) else "处理失败"
|
error_msg = "处理超时" if isinstance(doc_error, TimeoutError) else "处理失败"
|
||||||
|
|
||||||
processed_items.append({
|
processed_items.append(
|
||||||
"file_id": file_id,
|
{
|
||||||
"status": "failed",
|
"file_id": file_id,
|
||||||
"error": f"{error_msg}: {str(doc_error)}",
|
"status": "failed",
|
||||||
"error_type": error_type
|
"error": f"{error_msg}: {str(doc_error)}",
|
||||||
})
|
"error_type": error_type,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
await context.set_progress(100.0, "任务已取消")
|
await context.set_progress(100.0, "任务已取消")
|
||||||
@ -422,13 +424,15 @@ async def rechunks_documents(
|
|||||||
logger.exception(f"Task rechunking failed: {task_error}")
|
logger.exception(f"Task rechunking failed: {task_error}")
|
||||||
await context.set_progress(100.0, f"任务处理失败: {str(task_error)}")
|
await context.set_progress(100.0, f"任务处理失败: {str(task_error)}")
|
||||||
# 将所有未处理的文档标记为失败
|
# 将所有未处理的文档标记为失败
|
||||||
for file_id in file_ids[len(processed_items):]:
|
for file_id in file_ids[len(processed_items) :]:
|
||||||
processed_items.append({
|
processed_items.append(
|
||||||
"file_id": file_id,
|
{
|
||||||
"status": "failed",
|
"file_id": file_id,
|
||||||
"error": f"任务失败: {str(task_error)}",
|
"status": "failed",
|
||||||
"error_type": "task_failed"
|
"error": f"任务失败: {str(task_error)}",
|
||||||
})
|
"error_type": "task_failed",
|
||||||
|
}
|
||||||
|
)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
failed_count = len([_p for _p in processed_items if _p.get("status") == "failed"])
|
failed_count = len([_p for _p in processed_items if _p.get("status") == "failed"])
|
||||||
|
|||||||
@ -21,5 +21,6 @@ __all__ = [
|
|||||||
"prepare_item_metadata",
|
"prepare_item_metadata",
|
||||||
"split_text_into_chunks",
|
"split_text_into_chunks",
|
||||||
"split_text_into_qa_chunks",
|
"split_text_into_qa_chunks",
|
||||||
|
"merge_processing_params",
|
||||||
"validate_file_path",
|
"validate_file_path",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -229,7 +229,7 @@ def merge_processing_params(metadata_params: dict | None, request_params: dict |
|
|||||||
if request_params:
|
if request_params:
|
||||||
merged_params.update(request_params)
|
merged_params.update(request_params)
|
||||||
|
|
||||||
logger.debug(f"Merged processing params: metadata={metadata_params}, request={request_params}, result={merged_params}")
|
logger.debug(f"Merged processing params: {metadata_params=}, {request_params=}, {merged_params=}")
|
||||||
return merged_params
|
return merged_params
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,7 @@
|
|||||||
--color-success: #45b30e;
|
--color-success: #45b30e;
|
||||||
--color-error: #c73234;
|
--color-error: #c73234;
|
||||||
--color-info: #0058d4;
|
--color-info: #0058d4;
|
||||||
|
--color-warning: #faad14;
|
||||||
|
|
||||||
/* Chart Colors - 图表颜色系统 */
|
/* Chart Colors - 图表颜色系统 */
|
||||||
--chart-primary: var(--main-500); /* 主色调 - 用于主要数据 */
|
--chart-primary: var(--main-500); /* 主色调 - 用于主要数据 */
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
<div class="batch-info">
|
<div class="batch-info">
|
||||||
<span>{{ selectedRowKeys.length }} 项</span>
|
<span>{{ selectedRowKeys.length }} 项</span>
|
||||||
<a-button
|
<a-button
|
||||||
type="text"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
@click="selectAllFailedFiles"
|
@click="selectAllFailedFiles"
|
||||||
:disabled="lock"
|
:disabled="lock"
|
||||||
@ -61,20 +61,20 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="display: flex; gap: 4px;">
|
<div style="display: flex; gap: 4px;">
|
||||||
<a-button
|
<a-button
|
||||||
type="text"
|
type="link"
|
||||||
@click="handleBatchRechunk"
|
@click="handleBatchRechunk"
|
||||||
:loading="batchRechunking"
|
:loading="batchRechunking"
|
||||||
:disabled="!canBatchRechunk"
|
:disabled="!canBatchRechunk"
|
||||||
:icon="h(ReloadOutlined)"
|
:icon="h(RefreshCw)"
|
||||||
title="批量重新分块"
|
title="批量重新分块"
|
||||||
/>
|
/>
|
||||||
<a-button
|
<a-button
|
||||||
type="text"
|
type="link"
|
||||||
danger
|
danger
|
||||||
@click="handleBatchDelete"
|
@click="handleBatchDelete"
|
||||||
:loading="batchDeleting"
|
:loading="batchDeleting"
|
||||||
:disabled="!canBatchDelete"
|
:disabled="!canBatchDelete"
|
||||||
:icon="h(DeleteOutlined)"
|
:icon="h(Trash2)"
|
||||||
title="批量删除"
|
title="批量删除"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -121,33 +121,33 @@
|
|||||||
</a-button>
|
</a-button>
|
||||||
<span v-else-if="column.key === 'type'" :class="['span-type', text]">{{ text?.toUpperCase() }}</span>
|
<span v-else-if="column.key === 'type'" :class="['span-type', text]">{{ text?.toUpperCase() }}</span>
|
||||||
<div v-else-if="column.key === 'status'" style="display: flex; align-items: center; justify-content: flex-end;">
|
<div v-else-if="column.key === 'status'" style="display: flex; align-items: center; justify-content: flex-end;">
|
||||||
<CheckCircleFilled v-if="text === 'done'" style="color: #41A317;"/>
|
<CheckCircleFilled v-if="text === 'done'" style="color: var(--color-success);"/>
|
||||||
<CloseCircleFilled v-else-if="text === 'failed'" style="color: #FF4D4F;"/>
|
<CloseCircleFilled v-else-if="text === 'failed'" style="color: var(--color-error);"/>
|
||||||
<HourglassFilled v-else-if="text === 'processing'" style="color: #1677FF;"/>
|
<HourglassFilled v-else-if="text === 'processing'" style="color: var(--color-info);"/>
|
||||||
<ClockCircleFilled v-else-if="text === 'waiting'" style="color: #FFCD43;"/>
|
<ClockCircleFilled v-else-if="text === 'waiting'" style="color: var(--color-warning);"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a-tooltip v-else-if="column.key === 'created_at'" :title="formatRelativeTime(text)" placement="left">
|
<a-tooltip v-else-if="column.key === 'created_at'" :title="formatRelativeTime(text)" placement="left">
|
||||||
<span>{{ formatRelativeTime(text) }}</span>
|
<span>{{ formatRelativeTime(text) }}</span>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
|
|
||||||
<div v-else-if="column.key === 'action'" style="display: flex; gap: 4px;">
|
<div v-else-if="column.key === 'action'" class="table-row-actions">
|
||||||
<a-button class="download-btn" type="text"
|
<a-button class="download-btn" type="link"
|
||||||
@click="handleDownloadFile(record)"
|
@click="handleDownloadFile(record)"
|
||||||
:disabled="lock || record.status !== 'done'"
|
:disabled="lock || record.status !== 'done'"
|
||||||
:icon="h(DownloadOutlined)"
|
:icon="h(Download)"
|
||||||
title="下载"
|
title="下载"
|
||||||
/>
|
/>
|
||||||
<a-button class="rechunk-btn" type="text"
|
<a-button class="rechunk-btn" type="link"
|
||||||
@click="handleRechunkFile(record)"
|
@click="handleRechunkFile(record)"
|
||||||
:disabled="lock || record.status === 'processing' || record.status === 'waiting'"
|
:disabled="lock || record.status === 'processing' || record.status === 'waiting'"
|
||||||
:icon="h(ReloadOutlined)"
|
:icon="h(RefreshCw)"
|
||||||
title="重新分块"
|
title="重新分块"
|
||||||
/>
|
/>
|
||||||
<a-button class="del-btn" type="text"
|
<a-button class="del-btn" type="link"
|
||||||
@click="handleDeleteFile(record.file_id)"
|
@click="handleDeleteFile(record.file_id)"
|
||||||
:disabled="lock || record.status === 'processing' || record.status === 'waiting'"
|
:disabled="lock || record.status === 'processing' || record.status === 'waiting'"
|
||||||
:icon="h(DeleteOutlined)"
|
:icon="h(Trash2)"
|
||||||
title="删除"
|
title="删除"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -168,12 +168,15 @@ import {
|
|||||||
HourglassFilled,
|
HourglassFilled,
|
||||||
CloseCircleFilled,
|
CloseCircleFilled,
|
||||||
ClockCircleFilled,
|
ClockCircleFilled,
|
||||||
DeleteOutlined,
|
|
||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
DownloadOutlined,
|
|
||||||
ReloadOutlined,
|
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import { ChevronLast, RefreshCcw } from 'lucide-vue-next';
|
import {
|
||||||
|
Trash2,
|
||||||
|
Download,
|
||||||
|
RefreshCw,
|
||||||
|
ChevronLast,
|
||||||
|
RefreshCcw,
|
||||||
|
} from 'lucide-vue-next';
|
||||||
|
|
||||||
const store = useDatabaseStore();
|
const store = useDatabaseStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
@ -547,6 +550,11 @@ import ChunkParamsConfig from '@/components/ChunkParamsConfig.vue';
|
|||||||
|
|
||||||
button {
|
button {
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button:hover {
|
button:hover {
|
||||||
@ -597,12 +605,13 @@ import ChunkParamsConfig from '@/components/ChunkParamsConfig.vue';
|
|||||||
padding: 0 6px;
|
padding: 0 6px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.batch-actions .ant-btn:hover {
|
|
||||||
background-color: var(--main-20);
|
|
||||||
color: var(--main-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-table {
|
.my-table {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@ -626,6 +635,8 @@ import ChunkParamsConfig from '@/components/ChunkParamsConfig.vue';
|
|||||||
color: var(--main-color);
|
color: var(--main-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.my-table .del-btn {
|
.my-table .del-btn {
|
||||||
color: var(--gray-500);
|
color: var(--gray-500);
|
||||||
}
|
}
|
||||||
@ -642,8 +653,23 @@ import ChunkParamsConfig from '@/components/ChunkParamsConfig.vue';
|
|||||||
color: var(--gray-500);
|
color: var(--gray-500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 统一设置表格操作按钮的图标尺寸 */
|
||||||
|
.my-table .table-row-actions {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-table .table-row-actions button {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-table .table-row-actions button svg {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.my-table .rechunk-btn:hover {
|
.my-table .rechunk-btn:hover {
|
||||||
color: #faad14;
|
color: var(--color-warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
.my-table .del-btn:hover {
|
.my-table .del-btn:hover {
|
||||||
@ -701,15 +727,10 @@ import ChunkParamsConfig from '@/components/ChunkParamsConfig.vue';
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-action-btn.auto-refresh-btn.ant-btn-primary:hover {
|
|
||||||
background-color: var(--main-color) !important;
|
|
||||||
color: #fff !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-action-btn:hover {
|
.panel-action-btn:hover {
|
||||||
background-color: var(--main-5);
|
background-color: var(--gray-50);
|
||||||
color: var(--main-color);
|
color: var(--main-color);
|
||||||
border: 1px solid var(--main-color);
|
/* border: 1px solid var(--main-100); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user