Skip to content

Commit

Permalink
Enhance: Print std adn stderr to desktop app for ingestion flow
Browse files Browse the repository at this point in the history
Signed-off-by: Daishan Peng <[email protected]>
  • Loading branch information
StrongMonkey committed Sep 9, 2024
1 parent b6c00b5 commit d3d9df1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions actions/knowledge/knowledge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ export async function ingest(
}
const dir = path.join(path.dirname(workspace), 'knowledge');
const knowledgeBinaryPath = process.env.KNOWLEDGE_BIN;
await execPromise(
const { stdout, stderr } = await execPromise(
`${knowledgeBinaryPath} ingest --prune --dataset ${datasetID} ${dir.replace(/ /g, '\\ ')}`,
{ env: { ...process.env, GPTSCRIPT_GATEWAY_API_KEY: token } }
);
const combinedOutput = stdout + stderr;
console.log(`logs for ingesting dataset ${datasetID}: `, combinedOutput);
return;
}

Expand Down Expand Up @@ -105,14 +107,15 @@ async function runKnowledgeIngest(
knowledgePath: string,
token: string
): Promise<void> {
await execPromise(
const { stdout, stderr } = await execPromise(
`${process.env.KNOWLEDGE_BIN} ingest --prune --dataset ${id} ./data`,
{
cwd: knowledgePath,
env: { ...process.env, GPTSCRIPT_GATEWAY_API_KEY: token },
}
);

const combinedOutput = stdout + stderr;
console.log(`logs for ingesting dataset ${id}: `, combinedOutput);
return;
}

Expand Down

0 comments on commit d3d9df1

Please sign in to comment.