fix: [ML-575]: mark required fields for spec file (#3350)

* gci write
* lint errors fix
* lint errors fix
* required:'true'
* required : true
* done
* changed
* make stage type as enum according to openapi std
* remove conflicts with main
* mark fields as required
* Merge branch 'main' into ML-575
* make conversationID optional parameter in chat
* generate conversation ID in backend
* Merge branch 'main' into ML-575
* gci run
* gci run
* gci run
* gci run
* lint error fix
* gci run
* resolve comments
* re_generate to regenerate
* gci run
* lint errors fix
* lint error fix
* update actions struct correctly
* update actions struct
* lint error fix
* chat struct and two new enums for actions
* merged
* merge with ML-562
* temp
* done
* done
* remove redundant file
* fixed lint errors in submodule
* lint error fix
* Update wire_gen.go
* Update wire_gen.go
* fix lint errors
* updated error message
* changed loc of enum definitions
* new endpoint /chat
* new type chat
* original
* to original
* made required changes
* trial
* fix lint errors-3
* fi
This commit is contained in:
Prachi Shah 2025-01-30 11:43:49 +00:00 committed by Harness
parent f8a4584dca
commit 6b231495c1
2 changed files with 12 additions and 11 deletions

View File

@ -22,28 +22,28 @@ import (
// Chat represents a chat conversation with a unique ID, prompt, metadata, and conversation history.
type Chat struct {
ConversationID uuid.UUID `json:"conversation_uuid,omitempty"`
Prompt string `json:"prompt"`
Metadata map[string]string `json:"metadata"`
ConversationID uuid.UUID `json:"conversation_id,omitempty"`
Prompt string `json:"prompt" required:"true"`
Metadata map[string]string `json:"metadata" required:"true"`
Conversation []Conversation `json:"conversation"`
}
// ChatOutput represents the output of a chat request, including the conversation ID, explanation, and response.
type ChatOutput struct {
ConversationID uuid.UUID `json:"conversation_uuid"`
ConversationID uuid.UUID `json:"conversation_id" required:"true"`
Explanation string `json:"explanation,omitempty"`
Response []ChatResponse `json:"response"`
Response []ChatResponse `json:"response" required:"true"`
}
// ChatResponse represents a response in a chat conversation, including the role and message.
type ChatResponse struct {
Role enum.Role `json:"role"`
Message ResponseMessage `json:"message"`
Role enum.Role `json:"role" required:"true"`
Message ResponseMessage `json:"message" required:"true"`
}
// ResponseMessage represents a message in a chat response, including the type, data, and actions.
type ResponseMessage struct {
Type enum.MessageType `json:"type"`
Data string `json:"data"`
Type enum.MessageType `json:"type" required:"true"`
Data string `json:"data" required:"true"`
Actions []enum.Action `json:"actions,omitempty"`
}

View File

@ -15,6 +15,7 @@
package genai
import (
"github.com/harness/gitness/app/api/controller/aiagent/types/enum"
capabilities2 "github.com/harness/gitness/types/capabilities"
)
@ -55,8 +56,8 @@ func (PipelineContext) GetType() capabilities2.AIContextPayloadType {
const AIContextPayloadTypeStepContext capabilities2.AIContextPayloadType = "other"
type StepContext struct {
Yaml string `json:"step_yaml"`
StageType string `json:"stage_type"`
Yaml string `json:"step_yaml"`
StageType enum.StageType `json:"stage_type"`
}
func (StepContext) GetName() string {