Prepare requests with captured conversation history
This commit is contained in:
10
convert.go
10
convert.go
@@ -10,6 +10,13 @@ import (
|
||||
)
|
||||
|
||||
func toDomainRunRequest(req RunRequest) (domain.RunRequest, error) {
|
||||
var history *domain.Exchange
|
||||
if req.ContinueFrom != nil && req.ContinueFrom.internal == nil {
|
||||
return domain.RunRequest{}, fmt.Errorf("continuation exchange is empty")
|
||||
}
|
||||
if req.ContinueFrom != nil {
|
||||
history = req.ContinueFrom.internal
|
||||
}
|
||||
execution, err := toDomainExecutionTargetOverride(req.Execution)
|
||||
if err != nil {
|
||||
return domain.RunRequest{}, err
|
||||
@@ -24,6 +31,7 @@ func toDomainRunRequest(req RunRequest) (domain.RunRequest, error) {
|
||||
observer = func(event domain.ExecutionEvent) { callback(fromDomainExecutionEvent(event)) }
|
||||
}
|
||||
return domain.RunRequest{
|
||||
CaptureExchange: req.CaptureExchange || req.ContinueFrom != nil,
|
||||
PromptID: req.PromptID,
|
||||
ProfileID: req.ProfileID,
|
||||
SessionID: req.SessionID,
|
||||
@@ -35,6 +43,7 @@ func toDomainRunRequest(req RunRequest) (domain.RunRequest, error) {
|
||||
AppendedMessages: appendedMessages,
|
||||
TransientRetries: copyIntPtr(req.TransientRetries),
|
||||
Observer: observer,
|
||||
ContinueFrom: history,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -71,6 +80,7 @@ func fromDomainPreparedRun(prepared *domain.PreparedRun) *PreparedRun {
|
||||
return nil
|
||||
}
|
||||
return &PreparedRun{
|
||||
ParentRunID: prepared.ParentRunID,
|
||||
PromptID: prepared.PromptID,
|
||||
PromptHash: prepared.PromptHash,
|
||||
SelectedProfileID: prepared.SelectedProfileID,
|
||||
|
||||
Reference in New Issue
Block a user