From 142504b13ff11822d85413a8eccdca84355add85 Mon Sep 17 00:00:00 2001 From: wang zhuzhen Date: Thu, 21 Dec 2023 18:22:51 +0800 Subject: [PATCH] fix: optimal prompt (#6184) --- internal/pkg/ai-functions/functions/test-case/function.go | 2 +- internal/pkg/ai-functions/functions/test-case/group.go | 2 +- internal/pkg/ai-functions/provider.go | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/pkg/ai-functions/functions/test-case/function.go b/internal/pkg/ai-functions/functions/test-case/function.go index c4f437c510f..61b132e0f83 100644 --- a/internal/pkg/ai-functions/functions/test-case/function.go +++ b/internal/pkg/ai-functions/functions/test-case/function.go @@ -640,7 +640,7 @@ func processSingleTestCase(ctx context.Context, factory functions.FunctionFactor return errors.Wrap(err, "processSingleTestCase get requirement related tasks info failed") } for _, include := range issueRelations.IssueInclude { - if include.Type == apistructs.IssueTypeTask { + if include.Type == apistructs.IssueTypeTask && (include.TaskType == "dev" || include.TaskType == "开发") { tasks = append(tasks, include.Title) } } diff --git a/internal/pkg/ai-functions/functions/test-case/group.go b/internal/pkg/ai-functions/functions/test-case/group.go index 71534e1b7b3..68bcf9e639f 100644 --- a/internal/pkg/ai-functions/functions/test-case/group.go +++ b/internal/pkg/ai-functions/functions/test-case/group.go @@ -98,7 +98,7 @@ func generateGroupsFromRequirement(ctx context.Context, wg *sync.WaitGroup, user return errors.Wrap(err, "generateGroupsFromRequirement get requirement related tasks info failed") } for _, include := range issueRelations.IssueInclude { - if include.Type == apistructs.IssueTypeTask { + if include.Type == apistructs.IssueTypeTask && (include.TaskType == "dev" || include.TaskType == "开发") { tasks = append(tasks, include.Title) } } diff --git a/internal/pkg/ai-functions/provider.go b/internal/pkg/ai-functions/provider.go index b6df6c68441..36b7cb32554 100644 --- a/internal/pkg/ai-functions/provider.go +++ b/internal/pkg/ai-functions/provider.go @@ -19,8 +19,6 @@ import ( "os" "reflect" - "github.com/pkg/errors" - "github.com/erda-project/erda-infra/base/logs" "github.com/erda-project/erda-infra/base/servicehub" "github.com/erda-project/erda-infra/pkg/transport" @@ -72,7 +70,7 @@ func (p *provider) Init(ctx servicehub.Context) (err error) { p.Config.ModelIds["gpt-4"] = os.Getenv(handler.EnvAiProxyChatgpt4ModelId) } if p.Config.ModelIds["gpt-4"] == "" { - return errors.Errorf("env %s not set", handler.EnvAiProxyChatgpt4ModelId) + p.L.Warnf("env %s not set", handler.EnvAiProxyChatgpt4ModelId) } pb.RegisterAiFunctionImp(p.R, p.AIFunction())