mirror of
https://github.com/harness/drone.git
synced 2025-05-16 00:50:00 +08:00
feat: [ML-531]: Introduce conversations into request DTOs for AI Devops (#3239)
* Merge branch 'main' into yogesh/ML-531-conversationsDTO * Fixed Lint issues * transfer fields from handler to controller * Add to controller object * Add conversation DTOS
This commit is contained in:
parent
0ce1cde6c8
commit
a94be356c4
@ -27,7 +27,9 @@ func (c *Controller) GeneratePipelineStep(
|
|||||||
in *controllertypes.GeneratePipelineStepInput,
|
in *controllertypes.GeneratePipelineStepInput,
|
||||||
) (*controllertypes.GeneratePipelineStepOutput, error) {
|
) (*controllertypes.GeneratePipelineStepOutput, error) {
|
||||||
generateRequest := &aitypes.PipelineStepGenerateRequest{
|
generateRequest := &aitypes.PipelineStepGenerateRequest{
|
||||||
Prompt: in.Prompt,
|
Prompt: in.Prompt,
|
||||||
|
Metadata: in.Metadata,
|
||||||
|
Conversation: in.Conversation,
|
||||||
}
|
}
|
||||||
|
|
||||||
output, err := c.intelligence.GeneratePipelineStep(ctx, generateRequest)
|
output, err := c.intelligence.GeneratePipelineStep(ctx, generateRequest)
|
||||||
|
@ -21,4 +21,30 @@ type Suggestion struct {
|
|||||||
Suggestion string
|
Suggestion string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enum type for Role.
|
||||||
|
type Role string
|
||||||
|
|
||||||
|
const (
|
||||||
|
RoleUser Role = "user"
|
||||||
|
RoleAssistant Role = "assistant"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum type for Message Type.
|
||||||
|
type MessageType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
TypeText MessageType = "text"
|
||||||
|
TypeYAML MessageType = "yaml"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Conversation struct {
|
||||||
|
Role Role `json:"role"`
|
||||||
|
Message Message `json:"message"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Message struct {
|
||||||
|
Type MessageType `json:"type"`
|
||||||
|
Data string `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
// Additional common structs can be defined here as needed.
|
// Additional common structs can be defined here as needed.
|
||||||
|
@ -20,7 +20,9 @@ type PipelineStepData struct {
|
|||||||
|
|
||||||
// create.
|
// create.
|
||||||
type GeneratePipelineStepInput struct {
|
type GeneratePipelineStepInput struct {
|
||||||
Prompt string `json:"prompt"`
|
Prompt string `json:"prompt"`
|
||||||
|
Metadata map[string]string `json:"metadata"`
|
||||||
|
Conversation []Conversation `json:"conversation"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GeneratePipelineStepOutput struct {
|
type GeneratePipelineStepOutput struct {
|
||||||
@ -30,8 +32,9 @@ type GeneratePipelineStepOutput struct {
|
|||||||
|
|
||||||
// update.
|
// update.
|
||||||
type UpdatePipelineStepInput struct {
|
type UpdatePipelineStepInput struct {
|
||||||
Prompt string `json:"prompt"`
|
Prompt string `json:"prompt"`
|
||||||
Data PipelineStepData `json:"data"`
|
Data PipelineStepData `json:"data"`
|
||||||
|
Conversation []Conversation `json:"conversation"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdatePipelineStepOutput struct {
|
type UpdatePipelineStepOutput struct {
|
||||||
|
@ -14,8 +14,14 @@
|
|||||||
|
|
||||||
package types
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/harness/gitness/app/api/controller/aiagent/types"
|
||||||
|
)
|
||||||
|
|
||||||
type PipelineStepGenerateRequest struct {
|
type PipelineStepGenerateRequest struct {
|
||||||
Prompt string
|
Prompt string
|
||||||
|
Metadata map[string]string `json:"metadata"`
|
||||||
|
Conversation []types.Conversation `json:"conversation"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PipelineStepGenerateResponse struct {
|
type PipelineStepGenerateResponse struct {
|
||||||
@ -23,8 +29,10 @@ type PipelineStepGenerateResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PipelineStepUpdateRequest struct {
|
type PipelineStepUpdateRequest struct {
|
||||||
Prompt string
|
Prompt string
|
||||||
Step string
|
Step string
|
||||||
|
Metadata map[string]string `json:"metadata"`
|
||||||
|
Conversation []types.Conversation `json:"conversation"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PipelineStepUpdateResponse struct {
|
type PipelineStepUpdateResponse struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user