build fixes
This commit is contained in:
parent
c7e94aea79
commit
02bf4020d7
2 changed files with 7 additions and 36 deletions
|
|
@ -414,7 +414,12 @@ export async function fetchWorkflow(
|
|||
export async function createWorkflow(
|
||||
request: ApiRequestFunction,
|
||||
instanceId: string,
|
||||
body: { label: string; graph: Automation2Graph; invocations?: WorkflowEntryPoint[] }
|
||||
body: {
|
||||
label: string;
|
||||
graph: Automation2Graph;
|
||||
invocations?: WorkflowEntryPoint[];
|
||||
targetFeatureInstanceId?: string | null;
|
||||
}
|
||||
): Promise<Automation2Workflow> {
|
||||
return await request({
|
||||
url: `/api/workflows/${instanceId}/workflows`,
|
||||
|
|
@ -433,6 +438,7 @@ export async function updateWorkflow(
|
|||
invocations?: WorkflowEntryPoint[];
|
||||
active?: boolean;
|
||||
notifyOnFailure?: boolean;
|
||||
targetFeatureInstanceId?: string | null;
|
||||
}
|
||||
): Promise<Automation2Workflow> {
|
||||
return await request({
|
||||
|
|
|
|||
|
|
@ -122,9 +122,6 @@ export const TrusteeAnalyseView: React.FC = () => {
|
|||
const pollTimerRef = useRef<number | null>(null);
|
||||
const isPollingRef = useRef(false);
|
||||
|
||||
const [resultText, setResultText] = useState<string | null>(null);
|
||||
const [resultDocuments, setResultDocuments] = useState<Array<{ id?: string; fileName?: string; mimeType?: string }>>([]);
|
||||
|
||||
const [budgetFileId, setBudgetFileId] = useState<string | null>(null);
|
||||
const [budgetFileName, setBudgetFileName] = useState<string | null>(null);
|
||||
const [uploading, setUploading] = useState(false);
|
||||
|
|
@ -203,12 +200,6 @@ export const TrusteeAnalyseView: React.FC = () => {
|
|||
if (running.length === 0 && completed.length === steps.length && steps.length > 0) {
|
||||
setRunState('completed');
|
||||
_stopPolling();
|
||||
const lastStep = [...steps].reverse().find((s) => s.status === 'completed' && s.output);
|
||||
if (lastStep?.output) {
|
||||
setResultText(lastStep.output.response || lastStep.output.context || null);
|
||||
const docs = lastStep.output.documents || lastStep.output.documentList || [];
|
||||
setResultDocuments(Array.isArray(docs) ? docs : []);
|
||||
}
|
||||
showSuccess(t('Abgeschlossen'), t('Analyse-Workflow erfolgreich beendet.'));
|
||||
return;
|
||||
}
|
||||
|
|
@ -235,25 +226,6 @@ export const TrusteeAnalyseView: React.FC = () => {
|
|||
|
||||
useEffect(() => () => { _stopPolling(); }, [_stopPolling]);
|
||||
|
||||
const _extractResults = useCallback((nodeOutputs: Record<string, any>) => {
|
||||
const analyseOut = nodeOutputs?.analyse || nodeOutputs?.result;
|
||||
if (!analyseOut) {
|
||||
for (const key of Object.keys(nodeOutputs || {})) {
|
||||
const v = nodeOutputs[key];
|
||||
if (v && typeof v === 'object' && (v.response || v.documents)) {
|
||||
setResultText(v.response || v.context || null);
|
||||
const docs = v.documents || v.documentList || [];
|
||||
setResultDocuments(Array.isArray(docs) ? docs : []);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
setResultText(analyseOut.response || analyseOut.context || null);
|
||||
const docs = analyseOut.documents || analyseOut.documentList || [];
|
||||
setResultDocuments(Array.isArray(docs) ? docs : []);
|
||||
}, []);
|
||||
|
||||
// Reset run state when tab changes
|
||||
useEffect(() => {
|
||||
_stopPolling();
|
||||
|
|
@ -261,8 +233,6 @@ export const TrusteeAnalyseView: React.FC = () => {
|
|||
setRunId(null);
|
||||
setRunSummary('');
|
||||
setRunError(null);
|
||||
setResultText(null);
|
||||
setResultDocuments([]);
|
||||
}, [activeTab, _stopPolling]);
|
||||
|
||||
const _handleBudgetUpload = useCallback(async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
|
|
@ -305,8 +275,6 @@ export const TrusteeAnalyseView: React.FC = () => {
|
|||
setRunState('starting');
|
||||
setRunError(null);
|
||||
setRunSummary(t('Workflow wird gestartet…'));
|
||||
setResultText(null);
|
||||
setResultDocuments([]);
|
||||
try {
|
||||
const executeBody: Record<string, any> = { workflowId: wf.id };
|
||||
const payload: Record<string, any> = {
|
||||
|
|
@ -326,9 +294,6 @@ export const TrusteeAnalyseView: React.FC = () => {
|
|||
} else if (res?.data?.success) {
|
||||
setRunState('completed');
|
||||
setRunSummary(t('Workflow synchron abgeschlossen.'));
|
||||
if (res.data.nodeOutputs) {
|
||||
_extractResults(res.data.nodeOutputs);
|
||||
}
|
||||
showSuccess(t('Abgeschlossen'), t('Analyse-Workflow erfolgreich beendet.'));
|
||||
} else {
|
||||
throw new Error(res?.data?.error || t('Unerwartete Antwort'));
|
||||
|
|
|
|||
Loading…
Reference in a new issue