diff --git a/internal/core/service/forge_manager.go b/internal/core/service/forge_manager.go index f65b878..18a76fe 100644 --- a/internal/core/service/forge_manager.go +++ b/internal/core/service/forge_manager.go @@ -173,8 +173,12 @@ func (m *ForgeManager) GeneratePullRequest(ctx context.Context, user *model.User body := res.Message().Content() + body = strings.TrimSpace(body) + body = strings.TrimPrefix(body, "```markdown") + body = strings.TrimSuffix(body, "```") + messages = append(messages, res.Message()) - messages = append(messages, llm.NewMessage(llm.RoleUser, "Generate a title for this issue. Keep it descriptive, simple and short. Do not write anything else.")) + messages = append(messages, llm.NewMessage(llm.RoleUser, "Generate a title for this pull request. Keep it descriptive, simple and short. Do not write anything else. Use the same language.")) res, err = m.llmClient.ChatCompletion(ctx, llm.WithMessages(messages...)) if err != nil { @@ -184,7 +188,7 @@ func (m *ForgeManager) GeneratePullRequest(ctx context.Context, user *model.User title := toTitle(res.Message().Content()) messages = append(messages, res.Message()) - messages = append(messages, llm.NewMessage(llm.RoleUser, "Give me a list of questions as Markdown that could help clarify the request. Only write the list without additional headings.")) + messages = append(messages, llm.NewMessage(llm.RoleUser, "Give me a list of questions as Markdown that could help clarify the request. Only write the list without additional headings. Use the same language.")) res, err = m.llmClient.ChatCompletion(ctx, llm.WithMessages(messages...)) if err != nil { @@ -300,8 +304,12 @@ func (m *ForgeManager) GenerateIssue(ctx context.Context, user *model.User, proj body := res.Message().Content() + body = strings.TrimSpace(body) + body = strings.TrimPrefix(body, "```markdown") + body = strings.TrimSuffix(body, "```") + messages = append(messages, res.Message()) - messages = append(messages, llm.NewMessage(llm.RoleUser, "Generate a title for this issue. Keep it descriptive, simple and short. Do not write anything else.")) + messages = append(messages, llm.NewMessage(llm.RoleUser, "Generate a title for this issue. Keep it descriptive, simple and short. Do not write anything else. Use the same language.")) res, err = m.llmClient.ChatCompletion(ctx, llm.WithMessages(messages...)) if err != nil { @@ -311,7 +319,7 @@ func (m *ForgeManager) GenerateIssue(ctx context.Context, user *model.User, proj title := toTitle(res.Message().Content()) messages = append(messages, res.Message()) - messages = append(messages, llm.NewMessage(llm.RoleUser, "Give me a list of questions as Markdown that could help clarify the request. Only write the list without additional headings.")) + messages = append(messages, llm.NewMessage(llm.RoleUser, "Give me a list of questions as Markdown that could help clarify the request. Only write the list without additional headings. Use the same language.")) res, err = m.llmClient.ChatCompletion(ctx, llm.WithMessages(messages...)) if err != nil { diff --git a/internal/core/service/prompts/issue_user_prompt.gotmpl b/internal/core/service/prompts/issue_user_prompt.gotmpl index 7d4ad0d..73f0ba2 100644 --- a/internal/core/service/prompts/issue_user_prompt.gotmpl +++ b/internal/core/service/prompts/issue_user_prompt.gotmpl @@ -1,4 +1,6 @@ -Write a formatted issue/request based on the following informations: +Write a formatted issue/request based on the following informations. + +Do not write any output other than the issue. ## Request Summary diff --git a/internal/core/service/prompts/pull_request_user_prompt.gotmpl b/internal/core/service/prompts/pull_request_user_prompt.gotmpl index c36d885..7dbcc41 100644 --- a/internal/core/service/prompts/pull_request_user_prompt.gotmpl +++ b/internal/core/service/prompts/pull_request_user_prompt.gotmpl @@ -1,4 +1,6 @@ -Write a formatted pull request based on the following informations: +Write a formatted pull request based on the following informations. + +Do not write any output other than the pull request. ## Pull Request Summary