mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-12 20:23:21 +08:00
feat: add native result-file delivery
This commit is contained in:
parent
2803bbcbab
commit
d472dd5a75
65 changed files with 10205 additions and 255 deletions
|
|
@ -59,9 +59,23 @@ export async function askInWorkspaceSession({
|
|||
return { sessionId, session };
|
||||
});
|
||||
if (!binding) continue;
|
||||
const artifacts = [];
|
||||
const originalOnArtifact = typeof askOptions === 'object'
|
||||
&& typeof askOptions?.onArtifact === 'function'
|
||||
? askOptions.onArtifact
|
||||
: null;
|
||||
const artifactOptions = typeof askOptions === 'number'
|
||||
? { timeoutMs: askOptions }
|
||||
: { ...askOptions };
|
||||
artifactOptions.onArtifact = async (artifact) => {
|
||||
artifacts.push(artifact);
|
||||
await originalOnArtifact?.(artifact);
|
||||
};
|
||||
const answer = await binding.session.ask(content ?? text, artifactOptions);
|
||||
return {
|
||||
sessionId: binding.sessionId,
|
||||
answer: await binding.session.ask(content ?? text, askOptions),
|
||||
answer,
|
||||
...(artifacts.length > 0 ? { artifacts } : {}),
|
||||
};
|
||||
} catch (error) {
|
||||
if (error?.code !== WORKSPACE_SESSION_STALE) throw error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue