72 lines
1.7 KiB
Go
72 lines
1.7 KiB
Go
package domain
|
|
|
|
type AIInvocationRequest struct {
|
|
RequestID string
|
|
PluginID string
|
|
RouteKey string
|
|
ServerInstanceID string
|
|
Purpose string
|
|
ProviderID string
|
|
Model string
|
|
Prompt string
|
|
CurrentConfig string
|
|
ContextRefs map[string]string
|
|
}
|
|
|
|
type AIInvocationUsage struct {
|
|
ProviderID string
|
|
Model string
|
|
InputTokens int
|
|
OutputTokens int
|
|
Mocked bool
|
|
}
|
|
|
|
type AIConfigRecommendation struct {
|
|
Key string
|
|
SuggestedConfig string
|
|
DiffSummary string
|
|
}
|
|
|
|
type AIInvocationSafeError struct {
|
|
Code string
|
|
Message string
|
|
Details []string
|
|
}
|
|
|
|
type AIInvocationResponse struct {
|
|
RequestID string
|
|
Purpose string
|
|
ProviderID string
|
|
Model string
|
|
Status string
|
|
Recommendation string
|
|
ConfigRecommendation *AIConfigRecommendation
|
|
Usage AIInvocationUsage
|
|
Error *AIInvocationSafeError
|
|
}
|
|
|
|
type AIProviderInvocationResult struct {
|
|
Recommendation string
|
|
SuggestedConfig string
|
|
Usage AIInvocationUsage
|
|
Error *AIInvocationSafeError
|
|
}
|
|
|
|
func CopyAIInvocationRequest(request AIInvocationRequest) AIInvocationRequest {
|
|
request.ContextRefs = CopyStringMap(request.ContextRefs)
|
|
return request
|
|
}
|
|
|
|
func CopyAIInvocationResponse(response AIInvocationResponse) AIInvocationResponse {
|
|
if response.ConfigRecommendation != nil {
|
|
recommendation := *response.ConfigRecommendation
|
|
response.ConfigRecommendation = &recommendation
|
|
}
|
|
if response.Error != nil {
|
|
errorCopy := *response.Error
|
|
errorCopy.Details = CopyStringSlice(errorCopy.Details)
|
|
response.Error = &errorCopy
|
|
}
|
|
return response
|
|
}
|