fix: wait for openclaw artifact export
This commit is contained in:
parent
3f19c38f36
commit
01795c5450
@ -246,7 +246,7 @@ func (o *SessionOrchestrator) runOpenClawGatewayChat(
|
||||
}
|
||||
mergeOpenClawArtifactPayload(result, waitPayload)
|
||||
mergeOpenClawArtifactPayload(result, collector.artifactPayload())
|
||||
mergeOpenClawArtifactPayload(result, o.openClawArtifactExport(
|
||||
mergeOpenClawArtifactPayload(result, o.openClawArtifactExportForDelivery(
|
||||
gatewayProvider,
|
||||
chatParams,
|
||||
artifactRunID,
|
||||
@ -261,6 +261,49 @@ func (o *SessionOrchestrator) runOpenClawGatewayChat(
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (o *SessionOrchestrator) openClawArtifactExportForDelivery(
|
||||
gatewayProvider string,
|
||||
chatParams map[string]any,
|
||||
runID string,
|
||||
sinceUnixMs int64,
|
||||
preparedArtifact *openClawPreparedArtifactScope,
|
||||
artifactDeliveryRequired bool,
|
||||
notify func(map[string]any),
|
||||
) map[string]any {
|
||||
if !artifactDeliveryRequired {
|
||||
return o.openClawArtifactExport(
|
||||
gatewayProvider,
|
||||
chatParams,
|
||||
runID,
|
||||
sinceUnixMs,
|
||||
preparedArtifact,
|
||||
false,
|
||||
notify,
|
||||
)
|
||||
}
|
||||
const attempts = 5
|
||||
var payload map[string]any
|
||||
for attempt := 0; attempt < attempts; attempt++ {
|
||||
payload = o.openClawArtifactExport(
|
||||
gatewayProvider,
|
||||
chatParams,
|
||||
runID,
|
||||
sinceUnixMs,
|
||||
preparedArtifact,
|
||||
true,
|
||||
notify,
|
||||
)
|
||||
remoteWorkingDirectory := strings.TrimSpace(shared.StringArg(payload, "remoteWorkingDirectory", ""))
|
||||
if len(extractArtifactPayloads(payload, remoteWorkingDirectory)) > 0 {
|
||||
return payload
|
||||
}
|
||||
if attempt < attempts-1 {
|
||||
time.Sleep(time.Duration(attempt+1) * 400 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
return payload
|
||||
}
|
||||
|
||||
func isSessionTaskMethod(method string) bool {
|
||||
switch strings.TrimSpace(method) {
|
||||
case "session.start", "session.message":
|
||||
|
||||
Loading…
Reference in New Issue
Block a user