Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,386 changes: 1,433 additions & 953 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions ichiran/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde-lexpr = "0.1.3"
thiserror = "2"
csv-async = { version = "1.2", features = ["tokio"] }
csv-async = { version = "1.3", features = ["tokio"] }
regex = "1"
fancy-regex = "0.14"
lazy_static = "1.4.0"
strum_macros = "0.26"
fancy-regex = "0.17"
lazy_static = "1.5.0"
strum_macros = "0.27"
nonzero_ext = "0.3.0"
const_format = "0.2"
enclose = "1.1.8"
enclose = "1.2.1"
itertools = "0.14"
lru = "0.12"
lru = "0.16"

win32job = "2.0.3"

Expand Down
32 changes: 16 additions & 16 deletions niinii/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,42 @@ tokio-stream = { version = "0.1", features = ["sync"] }
tokio-util = "0.7"
futures = "0.3"
async-trait = "0.1"
backon = "1.3"
backon = "1.6"

# diagnostics
log = "0.4"
tracing = "0.1"
tracing-subscriber = { version = "0.3.0", features = ["env-filter"] }
tracing-subscriber = { version = "0.3.22", features = ["env-filter"] }
tracing-tracy = { version = "0.11", optional = true }
tracing-chrome = { version = "0.7.1", optional = true }
tracing-chrome = { version = "0.7.2", optional = true }

# language support
serde = { version = "1", features = ["derive"] }
serde_json = "1"
toml = "0.8"
toml = "0.9"
regex = "1"
fancy-regex = "0.14"
lazy_static = "1.4.0"
fancy-regex = "0.17"
lazy_static = "1.5.0"
num-traits = "0.2"
num-derive = "0.4"
strum = "0.26"
strum_macros = "0.26"
strum = "0.27"
strum_macros = "0.27"
thiserror = "2"
bitflags = "2.3"
enclose = "1.1.8"
once_cell = "1.17.1"
bitflags = "2.10"
enclose = "1.2.1"
once_cell = "1.21.3"
itertools = "0.14"

# capabilities
raw-window-handle = "0.5.2"
raw-window-handle-05 = { package = "raw-window-handle", version = "0.5.2" }
copypasta = "0.10"
flate2 = { version = "1.0" }
flate2 = { version = "1.1" }
deepl-api = "0.4"
dirs = "6.0"
rodio = { version = "0.20.1", optional = true }
rodio = { version = "0.21.1", optional = true }
# rayon = "1.5.1"
hudhook = { version = "0.8.0", optional = true }
nu-ansi-term = "0.50.1"
hudhook = { version = "0.8.3", optional = true }
nu-ansi-term = "0.50.3"

# interned
ichiran = { path = "../ichiran" }
Expand Down
18 changes: 8 additions & 10 deletions niinii/src/renderer/d3d11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ use std::time::Instant;
use std::{ptr, rc::Weak};

use imgui_winit_support::WinitPlatform;
use raw_window_handle::HasRawWindowHandle;
use raw_window_handle::RawWindowHandle;
use raw_window_handle_05::{HasRawWindowHandle, RawWindowHandle};
use winapi::{
shared::{
dxgi::*,
Expand Down Expand Up @@ -108,11 +107,11 @@ impl D3D11Renderer {
}

let hwnd = match window.raw_window_handle() {
RawWindowHandle::Win32(handle) => handle.hwnd,
RawWindowHandle::Win32(handle) => handle.hwnd as HWND,
_ => unreachable!(),
};

let (swapchain, device, context) = unsafe { create_device(hwnd as _) }.unwrap();
let (swapchain, device, context) = unsafe { create_device(hwnd) }.unwrap();
let main_rtv = unsafe { create_render_target(&swapchain, &device) };

let mut imgui = imgui::Context::create();
Expand Down Expand Up @@ -421,7 +420,7 @@ unsafe extern "system" fn mouse_proc(ncode: i32, wparam: WPARAM, lparam: LPARAM)
} = &mut *inner;

let hwnd = match window.raw_window_handle() {
RawWindowHandle::Win32(handle) => handle.hwnd,
RawWindowHandle::Win32(handle) => handle.hwnd as HWND,
_ => unreachable!(),
};

Expand All @@ -433,8 +432,7 @@ unsafe extern "system" fn mouse_proc(ncode: i32, wparam: WPARAM, lparam: LPARAM)
use winit::dpi::PhysicalPosition;

let mut client_pos = ms.pt;
let r =
winuser::ScreenToClient(hwnd as *mut _, &mut client_pos as *mut _);
let r = winuser::ScreenToClient(hwnd, &mut client_pos as *mut _);
debug_assert_eq!(r, TRUE);
let position =
PhysicalPosition::new(client_pos.x as f64, client_pos.y as f64);
Expand All @@ -457,16 +455,16 @@ unsafe extern "system" fn mouse_proc(ncode: i32, wparam: WPARAM, lparam: LPARAM)
// again (this code causes me physical pain)
let io = imgui.io_mut();
if *last_want_capture_mouse != io.want_capture_mouse {
let style = winuser::GetWindowLongA(hwnd as *mut _, winuser::GWL_EXSTYLE);
let style = winuser::GetWindowLongA(hwnd, winuser::GWL_EXSTYLE);
if io.want_capture_mouse {
winuser::SetWindowLongA(
hwnd as *mut _,
hwnd,
winuser::GWL_EXSTYLE,
(style as u32 & (!winuser::WS_EX_TRANSPARENT)) as i32,
);
} else {
winuser::SetWindowLongA(
hwnd as *mut _,
hwnd,
winuser::GWL_EXSTYLE,
(style as u32 | winuser::WS_EX_TRANSPARENT) as i32,
);
Expand Down
2 changes: 1 addition & 1 deletion niinii/src/renderer/glow_viewports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use glutin::{
use glutin_winit::DisplayBuilder;
use imgui::{ConfigFlags, ViewportFlags};
use imgui_winit_glow_renderer_viewports::Renderer as GlowViewportsRenderer;
use raw_window_handle::HasRawWindowHandle;
use raw_window_handle_05::HasRawWindowHandle;
use winit::{
dpi::{PhysicalPosition, PhysicalSize},
event::WindowEvent,
Expand Down
22 changes: 11 additions & 11 deletions openai/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ edition = "2021"
[dependencies]
tokio = { version = "1" }
tokio-stream = { version = "0.1", features = ["sync"] }
tokio-tungstenite = { version = "0.26", features = ["native-tls"] }
tokio-tungstenite = { version = "0.28", features = ["native-tls"] }

reqwest = { version = "0.12", features = ["json", "stream"] }
tiktoken-rs = "0.6"
backon = "1.3.0"
reqwest = { version = "0.13", features = ["json", "stream"] }
tiktoken-rs = "0.9"
backon = "1.6.0"

log = "0.4"
tracing = "0.1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_with = "3.0"
serde_with = "3.16"
serde-untagged = "0.1"
thiserror = "2"
lazy_static = "1.4.0"
strum = "0.26"
strum_macros = "0.26"
derive_more = { version = "1", features = ["display"] }
lazy_static = "1.5.0"
strum = "0.27"
strum_macros = "0.27"
derive_more = { version = "2", features = ["display"] }
futures-util = "0.3"
bon = "3.7.0"
bon = "3.8.2"

eventsource-stream = { path = "../third-party/eventsource-stream" }

[dev-dependencies]
tokio = { version = "1", features = ["rt", "macros"] }
# tracing-test = { version = "0.2.4", features = ["no-env-filter"] }
tracing-test = "0.2.4"
tracing-test = "0.2.5"
serde_path_to_error = "0.1"
1 change: 0 additions & 1 deletion openai/src/protocol/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ impl Message {
// https://platform.openai.com/docs/guides/text-generation/managing-tokens
if let Some(content) = &self.content {
let bpe = cl100k_base_singleton();
let bpe = bpe.lock();
// every message follows <im_start>{role/name}\n{content}<im_end>\n
4 + bpe.encode_with_special_tokens(content).len() as u32
} else {
Expand Down
2 changes: 0 additions & 2 deletions openai/src/protocol/responses.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use bon::Builder;
use serde::{Deserialize, Serialize};
use strum_macros::{EnumIter, IntoStaticStr};

use super::{untagged_ok_result, Result};
use crate::{
protocol::{ReasoningEffort, Role, StreamOptions, Verbosity},
ModelId,
Expand Down
4 changes: 1 addition & 3 deletions openai/src/responses/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
//! https://platform.openai.com/docs/guides/conversation-state?api-mode=responses

use reqwest::Method;
use tokio_stream::{Stream, StreamExt};
use tracing::Level;

pub use crate::protocol::responses::Request;
use crate::{protocol::responses, Client, Error};
use crate::{Client, Error};

impl Client {
#[tracing::instrument(level = Level::DEBUG, skip_all, err)]
Expand Down
8 changes: 4 additions & 4 deletions third-party/eventsource-stream/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fn end_of_line(input: &str) -> IResult<&str, &str> {
}

#[inline]
fn comment(input: &str) -> IResult<&str, RawEventLine> {
fn comment(input: &str) -> IResult<&str, RawEventLine<'_>> {
preceded(
take_while_m_n(1, 1, is_colon),
terminated(take_while(is_any_char), end_of_line),
Expand All @@ -94,7 +94,7 @@ fn comment(input: &str) -> IResult<&str, RawEventLine> {
}

#[inline]
fn field(input: &str) -> IResult<&str, RawEventLine> {
fn field(input: &str) -> IResult<&str, RawEventLine<'_>> {
terminated(
tuple((
take_while1(is_name_char),
Expand All @@ -109,10 +109,10 @@ fn field(input: &str) -> IResult<&str, RawEventLine> {
}

#[inline]
fn empty(input: &str) -> IResult<&str, RawEventLine> {
fn empty(input: &str) -> IResult<&str, RawEventLine<'_>> {
end_of_line(input).map(|(i, _)| (i, RawEventLine::Empty))
}

pub fn line(input: &str) -> IResult<&str, RawEventLine> {
pub fn line(input: &str) -> IResult<&str, RawEventLine<'_>> {
alt((comment, field, empty))(input)
}