mirror of https://github.com/harness/drone.git
[feat]: [ML-498]: Remved RepoRef from context being sent to LLMs (#3061)
* Addressed Comments * Fixed GoLint Issues * [feat]: [ML-498]: Remved RepoRef from context being sent to LLMspull/3597/head
parent
3c6e41f598
commit
ed0e904c59
|
@ -44,13 +44,7 @@ func (c *Controller) GeneratePipelineStep(
|
|||
RepoRef: in.RepoRef,
|
||||
}
|
||||
|
||||
// do permission check on repo here?
|
||||
repo, err := c.repoStore.FindByRef(ctx, in.RepoRef)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to find repo by ref: %w", err)
|
||||
}
|
||||
|
||||
output, err := c.intelligenceService.GenerateStep(ctx, generateRequest, repo)
|
||||
output, err := c.intelligenceService.GenerateStep(ctx, generateRequest)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("generate pipeline: %w", err)
|
||||
}
|
||||
|
|
|
@ -92,23 +92,14 @@ func (s *HarnessIntelligence) Generate(
|
|||
|
||||
func (s *HarnessIntelligence) GenerateStep(
|
||||
ctx context.Context,
|
||||
req *types.PipelineStepGenerateRequest,
|
||||
repo *types.Repository) (*types.PipelineStepGenerateResponse, error) {
|
||||
if req.RepoRef == "" {
|
||||
return nil, fmt.Errorf("no repo ref specified")
|
||||
}
|
||||
|
||||
req *types.PipelineStepGenerateRequest) (*types.PipelineStepGenerateResponse, error) {
|
||||
conversationID := uuid.New()
|
||||
chatRequest := &genai.ChatRequest{
|
||||
Prompt: req.Prompt,
|
||||
ConversationID: conversationID.String(),
|
||||
ConversationRaw: "",
|
||||
Context: genai.GenerateAIContext(
|
||||
genai.RepoRef{
|
||||
Ref: repo.Path,
|
||||
},
|
||||
),
|
||||
Capabilities: s.cr.Capabilities(),
|
||||
Context: genai.GenerateAIContext(),
|
||||
Capabilities: s.cr.Capabilities(),
|
||||
}
|
||||
|
||||
resp, err := s.CapabilitiesLoop(ctx, chatRequest)
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
package capabilities
|
||||
|
||||
import (
|
||||
"github.com/harness/gitness/app/store"
|
||||
"github.com/harness/gitness/git"
|
||||
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
||||
|
@ -31,10 +28,10 @@ func panicOnErr(err error) {
|
|||
}
|
||||
}
|
||||
|
||||
func ProvideCapabilities(repoStore store.RepoStore, git git.Interface) (*Registry, error) {
|
||||
func ProvideCapabilities() (*Registry, error) {
|
||||
registry := NewRegistry()
|
||||
panicOnErr(registry.RegisterListFilesCapability(ListFiles(repoStore, git)))
|
||||
panicOnErr(registry.RegisterGetFileCapability(GetFile(repoStore, git)))
|
||||
// panicOnErr(registry.RegisterListFilesCapability(ListFiles(repoStore, git)))
|
||||
// panicOnErr(registry.RegisterGetFileCapability(GetFile(repoStore, git)))
|
||||
panicOnErr(registry.RegisterDisplayYamlCapability(DisplayYaml()))
|
||||
return registry, nil
|
||||
}
|
||||
|
|
|
@ -422,7 +422,7 @@ func initSystem(ctx context.Context, config *types.Config) (*server.System, erro
|
|||
migrateWebhook := migrate.ProvideWebhookImporter(webhookConfig, transactor, webhookStore)
|
||||
migrateLabel := migrate.ProvideLabelImporter(transactor, labelStore, labelValueStore, spaceStore)
|
||||
migrateController := migrate2.ProvideController(authorizer, publicaccessService, gitInterface, provider, pullReq, rule, migrateWebhook, migrateLabel, resourceLimiter, auditService, repoIdentifier, transactor, spaceStore, repoStore)
|
||||
registry, err := capabilities.ProvideCapabilities(repoStore, gitInterface)
|
||||
registry, err := capabilities.ProvideCapabilities()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue