Skip to content

Commit

Permalink
feat: enhance translation instruction handling
Browse files Browse the repository at this point in the history
- Add conditional logic to include previous translation in instruction
- Improve formatting of instruction string when previous translation exists
  • Loading branch information
duocnv-firegroup committed Sep 9, 2024
1 parent b1a6330 commit c6673e2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,12 @@ func runServe(cmd *cobra.Command, args []string) error {
}
})

instructment := `previous translation:` + currentTranslatedContent + `\n` + req.Instructions
instructment := req.Instructions

if len(currentTranslatedContent) == 0{
instructment = `Previous translation:\n\n` + currentTranslatedContent + `\n\n` + instructment
}


translatedContent, err := translateWithAI(originalContent, instructment)
if err != nil {
Expand Down

0 comments on commit c6673e2

Please sign in to comment.