generated from hack-ink/rust-initializer
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
571c47d
commit 82b5975
Showing
19 changed files
with
2,419 additions
and
368 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
// TODO:detect input language. | ||
// self | ||
use super::setting::Translation; | ||
|
||
#[derive(Debug)] | ||
pub enum Function { | ||
Polish, | ||
// Translate, | ||
Rewrite, | ||
RewriteDirectly, | ||
Translate, | ||
TranslateDirectly, | ||
} | ||
impl Function { | ||
pub fn prompt(&self) -> &'static str { | ||
pub fn prompt(&self, setting: &Translation) -> String { | ||
match self { | ||
Self::Polish => | ||
Self::Rewrite | Self::RewriteDirectly => | ||
"As an English professor, assist me in refining this text. \ | ||
Amend any grammatical errors and enhance the language to sound more like a native speaker.\ | ||
Provide the refined text only, without any other things.", | ||
// Self::Translate => "\ | ||
// Translate the following text into English.\ | ||
// ", | ||
Provide the refined text only, without any other things." | ||
.into(), | ||
Self::Translate | Self::TranslateDirectly => format!( | ||
"As a language professor, assist me in translate this text from {} to {}. \ | ||
Amend any grammatical errors and enhance the language to sound more like a native speaker.\ | ||
Provide the translated text only, without any other things.", | ||
setting.source.as_str(), | ||
setting.target.as_str() | ||
), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.