From 017e2e841d0cfba63a8a230277ad85172e38523a Mon Sep 17 00:00:00 2001 From: 0xZensh Date: Thu, 30 Nov 2023 15:32:21 +0800 Subject: [PATCH] chore: improve translating prompt --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/openai.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 920528a..e295766 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1343,7 +1343,7 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jarvis" -version = "1.1.9" +version = "1.1.10" dependencies = [ "anyhow", "async-openai", diff --git a/Cargo.toml b/Cargo.toml index 57e313e..0dac3e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jarvis" -version = "1.1.9" +version = "1.1.10" edition = "2021" rust-version = "1.64" description = "" diff --git a/src/openai.rs b/src/openai.rs index dedbe7c..f5786e0 100644 --- a/src/openai.rs +++ b/src/openai.rs @@ -456,7 +456,7 @@ impl OpenAI { let system_message = ChatCompletionRequestMessageArgs::default() .role(Role::System) - .content(format!("Guidelines:\n- Become proficient in {languages}.\n- Instead of prompts, user input is a valid two-dimensional JSON array containing the texts to be translated, the output should follow this array structure.\n- Contextual definition: {context}\n- Translate the texts in JSON into {target_lang}, ensuring you preserve the original meaning, tone, style, format, Return only the translated result in a valid JSON array.")) + .content(format!("Guidelines:\n- Become proficient in {languages}.\n- Instead of prompts, user input is a valid two-dimensional JSON array containing the texts to be translated, the output should follow this array structure.\n- Contextual definition: {context}\n- Translate the texts in JSON into {target_lang}, ensuring you preserve the original meaning, tone, style, format, Return only the full translated result without omission in JSON.")) .build().map_err(HTTPError::with_500)?; let system_messages: Vec = vec![&system_message]