diff options
| author | sigoden <sigoden@gmail.com> | 2025-07-03 08:50:21 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-03 08:50:21 +0800 |
| commit | a833512c19f501f1bea84166e6e41b97274f530b (patch) | |
| tree | 73f4876d3123cc695f6bbfd094347bd519d4e31f | |
| parent | 65efb2100fa774a3c403ede5a4245bc724c81572 (diff) | |
| download | aichat-a833512c19f501f1bea84166e6e41b97274f530b.tar.gz | |
refactor: update deps and models.yaml (#1339)
| -rw-r--r-- | Cargo.lock | 47 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | models.yaml | 16 | ||||
| -rw-r--r-- | src/config/mod.rs | 4 | ||||
| -rw-r--r-- | src/render/markdown.rs | 6 | ||||
| -rw-r--r-- | src/utils/mod.rs | 5 |
6 files changed, 52 insertions, 28 deletions
@@ -49,7 +49,7 @@ dependencies = [ "async-trait", "aws-smithy-eventstream", "base64", - "bincode", + "bincode 2.0.1", "bitflags 2.9.1", "bm25", "bytes", @@ -329,6 +329,16 @@ dependencies = [ ] [[package]] +name = "bincode" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" +dependencies = [ + "serde", + "unty", +] + +[[package]] name = "bit-set" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1168,9 +1178,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "h2" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9421a676d1b147b16b82c9225157dc629087ef8ec4d5e2960f9437a90dac0a5" +checksum = "17da50a276f1e01e0ba6c029e47b7100754904ee8a278f886546e98575380785" dependencies = [ "atomic-waker", "bytes", @@ -1235,7 +1245,7 @@ checksum = "b53dc5b9b07424143d016ba843c9b510f424e239118697f5d5d582f2d437df41" dependencies = [ "anndists", "anyhow", - "bincode", + "bincode 1.3.3", "cfg-if", "cpu-time", "env_logger", @@ -1565,6 +1575,17 @@ dependencies = [ ] [[package]] +name = "io-uring" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013" +dependencies = [ + "bitflags 2.9.1", + "cfg-if", + "libc", +] + +[[package]] name = "ipnet" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2602,9 +2623,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.20" +version = "0.12.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabf4c97d9130e2bf606614eb937e86edac8292eaa6f422f995d7e8de1eb1813" +checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" dependencies = [ "base64", "bytes", @@ -3202,7 +3223,7 @@ version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "874dcfa363995604333cf947ae9f751ca3af4522c60886774c4963943b4746b1" dependencies = [ - "bincode", + "bincode 1.3.3", "bitflags 1.3.2", "flate2", "fnv", @@ -3419,16 +3440,18 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.45.1" +version = "1.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" +checksum = "1140bb80481756a8cbe10541f37433b459c5aa1e727b4c020fbfebdc25bf3ec4" dependencies = [ "backtrace", "bytes", + "io-uring", "libc", "mio 1.0.4", "pin-project-lite", "signal-hook-registry", + "slab", "socket2", "tokio-macros", "windows-sys 0.52.0", @@ -3673,6 +3696,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] +name = "unty" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" + +[[package]] name = "url" version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -27,7 +27,7 @@ tokio-graceful = "0.2.2" tokio-stream = { version = "0.1.15", default-features = false, features = ["sync"] } crossterm = "0.28.1" chrono = "0.4.23" -bincode = "1.3.3" +bincode = { version = "2.0.0", features = ["serde", "std"], default-features = false } parking_lot = "0.12.1" fancy-regex = "0.14.0" base64 = "0.22.0" diff --git a/models.yaml b/models.yaml index a0a761c..9310c39 100644 --- a/models.yaml +++ b/models.yaml @@ -853,7 +853,6 @@ max_input_tokens: 131072 input_price: 0.112 output_price: 0.448 - supports_function_calling: true - name: ernie-4.5-turbo-vl-32k max_input_tokens: 32768 input_price: 0.42 @@ -1254,17 +1253,6 @@ body: temperature: null top_p: null - - name: openai/gpt-4-turbo - max_input_tokens: 128000 - input_price: 10 - output_price: 30 - supports_vision: true - supports_function_calling: true - - name: openai/gpt-3.5-turbo - max_input_tokens: 16385 - input_price: 0.5 - output_price: 1.5 - supports_function_calling: true - name: google/gemini-2.5-flash max_input_tokens: 1048576 input_price: 0.15 @@ -1370,7 +1358,7 @@ output_price: 2 supports_function_calling: true supports_vision: true - - name: mistralai/mistral-small-3.1-24b-instruct + - name: mistralai/mistral-small-3.2-24b-instruct max_input_tokens: 131072 input_price: 0.1 output_price: 0.3 @@ -1754,7 +1742,7 @@ max_input_tokens: 131072 input_price: 0.1 output_price: 0.2 - - name: mistralai/Mistral-Small-24B-Instruct-2501 + - name: mistralai/Mistral-Small-3.2-24B-Instruct-2506 max_input_tokens: 32768 input_price: 0.06 output_price: 0.12 diff --git a/src/config/mod.rs b/src/config/mod.rs index b52debe..04ae4ef 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -1913,9 +1913,9 @@ impl Config { Some(theme) } else { let theme = if self.light_theme() { - bincode::deserialize_from(LIGHT_THEME).expect("Invalid builtin light theme") + decode_bin(LIGHT_THEME).context("Invalid builtin light theme")? } else { - bincode::deserialize_from(DARK_THEME).expect("Invalid builtin dark theme") + decode_bin(DARK_THEME).context("Invalid builtin dark theme")? }; Some(theme) } diff --git a/src/render/markdown.rs b/src/render/markdown.rs index 33cdf47..9671961 100644 --- a/src/render/markdown.rs +++ b/src/render/markdown.rs @@ -1,3 +1,5 @@ +use crate::utils::decode_bin; + use ansi_colours::AsRGB; use anyhow::{anyhow, Context, Result}; use crossterm::style::{Color, Stylize}; @@ -30,8 +32,8 @@ pub struct MarkdownRender { impl MarkdownRender { pub fn init(options: RenderOptions) -> Result<Self> { - let syntax_set: SyntaxSet = bincode::deserialize_from(SYNTAXES) - .with_context(|| "MarkdownRender: invalid syntaxes binary")?; + let syntax_set: SyntaxSet = + decode_bin(SYNTAXES).with_context(|| "MarkdownRender: invalid syntaxes binary")?; let code_color = options .theme diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 1f2a592..8a90516 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -214,6 +214,11 @@ pub fn set_proxy( Ok(builder) } +pub fn decode_bin<T: serde::de::DeserializeOwned>(data: &[u8]) -> Result<T> { + let (v, _) = bincode::serde::decode_from_slice(data, bincode::config::legacy())?; + Ok(v) +} + #[cfg(test)] mod tests { use super::*; |
