mirror of
https://github.com/harness/drone.git
synced 2025-05-05 03:41:45 +08:00

* Return empty summary/branch for now * Fix Lint Issues * feat: [ML-288]: API skeletons for Harness Intelligence * fix ai pipelines (#2659) * fix ai pipelines * Update pipeline name (#2658) * Update pipeline name * fix: [ML-288]: update remediation prompt and suggestions (#2652) * fix: [ML-288]: update remediation prompt and suggestions * fix: [ML-288]: update url for artifact registry (#2651) * fix: [ML-288]: update url for artifact registry * Add snippet to mark code as written by Harness Intelligence (#2628) * Add snippet to mark code as written by Harness Intelligence * Add snippet to mark code as written by Harness Intelligence (#2626) * Add snippet to mark code as written by Harness Intelligence * feat: [ML-288]: link to harness artifact registry (#2619) * some linting fixes * feat: [ML-288]: link to harness artifact registry * feat: [ML-286]: updating pipeline suggestions (#2620) * updating suggestions * feat: [ML-286]: updating pipeline suggestions * feat: [ML-288]: adding slackbot (#2603) * updating slack responses * prevent responding to any bot messages * feat: [ML-288]: adding slackbot * throw error for commit * commit stubbed * feat: [ML-286]: moving stubbed response earlier in execution (#2602) * feat: [ML-286]: moving stubbed response earlier in execution * feat: [ML-286]: adding stubbed response for analyze execution (#2600) * updating branch name * adding updated-main for analyse-execution endpoint * feat: [ML-286]: adding stubbed response for analyze execution * Update AnalyseExecutionOutput to contain multi file diff (#2592) * Create branch and commit changes on analyse * Simplify AnalyseExecutionOutput to contain only high level summary and branch * Update AnalyseExecutionOutput to contain multi file diff * updating endpoints for unscripted demo (#2594) * cleaning up code, adding suggested pipeline response * updating suggestions api * updating endpoints for unscripted demo * Stub out generate pipeline yaml
56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
// Copyright 2023 Harness, Inc.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package aiagent
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/harness/gitness/types"
|
|
)
|
|
|
|
type UpdatePipelineOutput struct {
|
|
Status string `json:"status"`
|
|
Data PipelineData `json:"data"`
|
|
}
|
|
|
|
type UpdatePipelineInput struct {
|
|
Prompt string `json:"prompt"`
|
|
RepoRef string `json:"repo_ref"`
|
|
Pipeline string `json:"pipeline"`
|
|
}
|
|
|
|
func (c *Controller) UpdatePipeline(
|
|
ctx context.Context,
|
|
in *UpdatePipelineInput,
|
|
) (*UpdatePipelineOutput, error) {
|
|
generateRequest := &types.PipelineUpdateRequest{
|
|
Prompt: in.Prompt,
|
|
RepoRef: in.RepoRef,
|
|
Pipeline: in.Pipeline,
|
|
}
|
|
|
|
output, err := c.pipeline.Update(ctx, generateRequest)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("update pipeline: %w", err)
|
|
}
|
|
return &UpdatePipelineOutput{
|
|
Status: "SUCCESS",
|
|
Data: PipelineData{
|
|
YamlPipeline: output.YAML,
|
|
},
|
|
}, nil
|
|
}
|