feat(schedule):cron支持图形,RoHS检核增加进度显示

This commit is contained in:
hugo committed 2026-06-15 13:42:15 +08:00
1 parent 6d0e78be81
commit f5aac9c893
46 files changed
+1987 -221

No files matched your search

@@ -83,6 +83,11 @@ const applyEventMetadata = (msg: ChatMessage, data: Record<string, unknown>) =>
addAttributionParts(msg, metadata?.annotation_reply);
addAttributionParts(msg, data?.citation);
addAttributionParts(msg, metadata?.citation);
const messagePayload = data?.message_payload;
if (messagePayload && typeof messagePayload === 'object') {
msg.payload = messagePayload;
}
};
export function useChat() {
@@ -124,6 +129,27 @@ export function useChat() {
return text.replace(/\\n/g, '\n');
};
const formatStreamError = (message: unknown) => {
if (typeof message === 'string') return message;
if (message && typeof message === 'object') {
const record = message as Record<string, unknown>;
const nested = record.error;
if (typeof nested === 'string') return nested;
if (nested && typeof nested === 'object') {
const nestedRecord = nested as Record<string, unknown>;
if (typeof nestedRecord.message === 'string') return nestedRecord.message;
}
if (typeof record.message === 'string') return record.message;
if (typeof record.code === 'string') return record.code;
try {
return JSON.stringify(message);
} catch {
return 'Unknown error';
}
}
return String(message ?? 'Unknown error');
};
const sendMessage = async (
query: string,
agentId: number,
@@ -269,6 +295,13 @@ export function useChat() {
const currentBotMsg = runMessages[botMsgIndex];
if (currentBotMsg) currentBotMsg.chat_log_id = Number(data.chat_log_id);
}
if (botMsgIndex !== null) {
const runId = Number(data.run_id);
if (Number.isFinite(runId) && runId > 0) {
const currentBotMsg = runMessages[botMsgIndex];
if (currentBotMsg) currentBotMsg.run_id = runId;
}
}
if (typeof data.answer === 'string' && data.answer.length > 0) {
const botMsg = ensureBotMessage();
if (!botMsg) continue;
@@ -286,7 +319,7 @@ export function useChat() {
} else if (eventName === 'error') {
const botMsg = ensureBotMessage();
if (!botMsg) continue;
botMsg.content += `\n[Error: ${data.message}]`;
botMsg.content += `\n[Error: ${formatStreamError(data.message)}]`;
run.status = 'error';
if (messages.value === runMessages) isThinking.value = false;
} else if (typeof data.answer === 'string' && data.answer.length > 0) {