Doner1937 commited on
Commit
27d497d
·
verified ·
1 Parent(s): 5d68d7e

Bug Resolved

Browse files

Brittany Gietzen found a bug; the files were not getting processed correctly on Hugging Space, but worked on the backup Solution. Debugging the code, found the issue to be incorrect text formatting, which caused the Dify workflow to finish.

Files changed (1) hide show
  1. services/difyService.ts +1 -1
services/difyService.ts CHANGED
@@ -1385,7 +1385,7 @@ export const runWorkflow = async (inputs: ApiInput): Promise<ProcessedResult> =>
1385
  responseText = streamContent;
1386
 
1387
  const lines = streamContent.trim().split('\n');
1388
- const finishedLine = lines.find(line => line.includes('"event": "workflow_finished"')) || '';
1389
 
1390
  if (!finishedLine) {
1391
  // The gateway might have returned an HTML error page instead of a stream
 
1385
  responseText = streamContent;
1386
 
1387
  const lines = streamContent.trim().split('\n');
1388
+ const finishedLine = lines.find(l => /"event"\s*:\s*"workflow_finished"/.test(l) || l.includes('"workflow_finished"')) || ''; //regex checking
1389
 
1390
  if (!finishedLine) {
1391
  // The gateway might have returned an HTML error page instead of a stream