summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTatsuya Kyushima <49891479+kyu08@users.noreply.github.com>2024-05-02 18:17:50 +0900
committerGitHub <noreply@github.com>2024-05-02 17:17:50 +0800
commitebad4bb88842812c9a2633cb9e06071114519314 (patch)
tree7c747ee9356a22f9168370ddb76d7764320f3763 /src
parentb6957ae3af07608d92b7dda1709997a8da77c62b (diff)
downloadaichat-ebad4bb88842812c9a2633cb9e06071114519314.tar.gz
chore: fix typos (#476)
Diffstat (limited to 'src')
-rw-r--r--src/client/bedrock.rs4
-rw-r--r--src/client/qianwen.rs2
-rw-r--r--src/config/session.rs4
-rw-r--r--src/render/markdown.rs4
-rw-r--r--src/utils/tiktoken.rs2
5 files changed, 8 insertions, 8 deletions
diff --git a/src/client/bedrock.rs b/src/client/bedrock.rs
index d6ab696..6abd939 100644
--- a/src/client/bedrock.rs
+++ b/src/client/bedrock.rs
@@ -141,7 +141,7 @@ async fn send_message(
match model_category {
ModelCategory::Anthropic => claude_extract_completion(&data),
ModelCategory::MetaLlama3 => llama_extract_completion(&data),
- ModelCategory::Mistral => mistral_extrat_completion(&data),
+ ModelCategory::Mistral => mistral_extract_completion(&data),
}
}
@@ -283,7 +283,7 @@ fn llama_extract_completion(data: &Value) -> Result<(String, CompletionDetails)>
Ok((text.to_string(), details))
}
-fn mistral_extrat_completion(data: &Value) -> Result<(String, CompletionDetails)> {
+fn mistral_extract_completion(data: &Value) -> Result<(String, CompletionDetails)> {
let text = data["outputs"][0]["text"]
.as_str()
.ok_or_else(|| anyhow!("Invalid response data: {data}"))?;
diff --git a/src/client/qianwen.rs b/src/client/qianwen.rs
index 76d7436..3fa17e6 100644
--- a/src/client/qianwen.rs
+++ b/src/client/qianwen.rs
@@ -210,7 +210,7 @@ fn extract_completion_text(data: &Value, is_vl: bool) -> Result<(String, Complet
Ok((text.to_string(), details))
}
-/// Patch messsages, upload embedded images to oss
+/// Patch messages, upload embedded images to oss
async fn patch_messages(model: &str, api_key: &str, messages: &mut Vec<Message>) -> Result<()> {
for message in messages {
if let MessageContent::Array(list) = message.content.borrow_mut() {
diff --git a/src/config/session.rs b/src/config/session.rs
index 4ebf0d3..e6ad647 100644
--- a/src/config/session.rs
+++ b/src/config/session.rs
@@ -124,8 +124,8 @@ impl Session {
data["save_session"] = save_session.into();
}
data["total_tokens"] = tokens.into();
- if let Some(conext_window) = self.model.max_input_tokens {
- data["max_input_tokens"] = conext_window.into();
+ if let Some(context_window) = self.model.max_input_tokens {
+ data["max_input_tokens"] = context_window.into();
}
if percent != 0.0 {
data["total/max"] = format!("{}%", percent).into();
diff --git a/src/render/markdown.rs b/src/render/markdown.rs
index 1fb2f5b..3f68ea2 100644
--- a/src/render/markdown.rs
+++ b/src/render/markdown.rs
@@ -140,11 +140,11 @@ impl MarkdownRender {
fn highlight_line(&self, line: &str, syntax: &SyntaxReference, is_code: bool) -> String {
let ws: String = line.chars().take_while(|c| c.is_whitespace()).collect();
- let trimed_line: &str = &line[ws.len()..];
+ let trimmed_line: &str = &line[ws.len()..];
let mut line_highlighted = None;
if let Some(theme) = &self.options.theme {
let mut highlighter = HighlightLines::new(syntax, theme);
- if let Ok(ranges) = highlighter.highlight_line(trimed_line, &self.syntax_set) {
+ if let Ok(ranges) = highlighter.highlight_line(trimmed_line, &self.syntax_set) {
line_highlighted = Some(format!(
"{ws}{}",
as_terminal_escaped(&ranges, self.options.truecolor)
diff --git a/src/utils/tiktoken.rs b/src/utils/tiktoken.rs
index 8b7e712..cd83ed3 100644
--- a/src/utils/tiktoken.rs
+++ b/src/utils/tiktoken.rs
@@ -128,7 +128,7 @@ pub fn byte_pair_split<'a>(piece: &'a [u8], ranks: &HashMap<Vec<u8>, usize>) ->
// Originally, we had one too! Without it, we were only vaguely faster than Python.
// I used an RWLock to protect the cache. This didn't seem to hurt single threaded performance
// noticeably, but it did affect multi-threaded performance. Weirdly, it seemed to affect
-// multi-threaded performance even when I only had readers (maybed I messed something up?).
+// multi-threaded performance even when I only had readers (maybe I messed something up?).
// Anyway, I realised that we could get rid of the cache, if we treat the set of tokens as a cache!
// These are exactly the set or merges that are likely to be hot. And now we don't have to think
// about interior mutability, memory use, or cloning.