Bug Resolved
Browse filesBrittany 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.
- 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(
|
| 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
|