mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-07 23:03:43 +08:00
Merge pull request #395 from kevin9327/chore/restore-make-check-green
chore: restore a green `make check` on main
This commit is contained in:
@@ -209,6 +209,10 @@ fn set_directory_permissions(path: &Path) -> Result<()> {
|
|||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o700))?;
|
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o700))?;
|
||||||
}
|
}
|
||||||
|
#[cfg(not(unix))]
|
||||||
|
{
|
||||||
|
let _ = path;
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,6 +222,10 @@ fn set_file_permissions(path: &Path) -> Result<()> {
|
|||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o600))?;
|
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o600))?;
|
||||||
}
|
}
|
||||||
|
#[cfg(not(unix))]
|
||||||
|
{
|
||||||
|
let _ = path;
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,9 +151,8 @@ impl Provider for OpenAiResponsesProvider {
|
|||||||
if !thinking_open { thinking_open = true; yield ModelEvent::ThinkingStart; }
|
if !thinking_open { thinking_open = true; yield ModelEvent::ThinkingStart; }
|
||||||
if let Some(delta) = value.get("delta").and_then(Value::as_str) { yield ModelEvent::ThinkingDelta(delta.into()); }
|
if let Some(delta) = value.get("delta").and_then(Value::as_str) { yield ModelEvent::ThinkingDelta(delta.into()); }
|
||||||
}
|
}
|
||||||
"response.reasoning_summary_text.done" | "response.reasoning_text.done" => {
|
"response.reasoning_summary_text.done" | "response.reasoning_text.done"
|
||||||
if thinking_open { thinking_open = false; yield ModelEvent::ThinkingEnd; }
|
if thinking_open => { thinking_open = false; yield ModelEvent::ThinkingEnd; }
|
||||||
}
|
|
||||||
"response.output_item.added" => {
|
"response.output_item.added" => {
|
||||||
let item = value.get("item").unwrap_or(&Value::Null);
|
let item = value.get("item").unwrap_or(&Value::Null);
|
||||||
if item.get("type").and_then(Value::as_str) == Some("function_call") {
|
if item.get("type").and_then(Value::as_str) == Some("function_call") {
|
||||||
|
|||||||
+12
-12
@@ -323,6 +323,18 @@ fn model_from_row(row: sqlx::sqlite::SqliteRow) -> Result<ModelConfig> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn optional_u64(row: &sqlx::sqlite::SqliteRow, column: &str) -> Result<Option<u64>> {
|
||||||
|
row.try_get::<Option<i64>, _>(column)?
|
||||||
|
.map(|value| {
|
||||||
|
u64::try_from(value).map_err(|_| Error::Config(format!("{column} cannot be negative")))
|
||||||
|
})
|
||||||
|
.transpose()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_i64(value: u64) -> Result<i64> {
|
||||||
|
i64::try_from(value).map_err(|_| Error::Config("token value is too large".into()))
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
@@ -387,15 +399,3 @@ mod tests {
|
|||||||
assert_eq!(cleared.group_name, None);
|
assert_eq!(cleared.group_name, None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn optional_u64(row: &sqlx::sqlite::SqliteRow, column: &str) -> Result<Option<u64>> {
|
|
||||||
row.try_get::<Option<i64>, _>(column)?
|
|
||||||
.map(|value| {
|
|
||||||
u64::try_from(value).map_err(|_| Error::Config(format!("{column} cannot be negative")))
|
|
||||||
})
|
|
||||||
.transpose()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_i64(value: u64) -> Result<i64> {
|
|
||||||
i64::try_from(value).map_err(|_| Error::Config("token value is too large".into()))
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -125,7 +125,10 @@ async fn offline_crud_round_trip_persists_markdown() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let added: AddResponse = decode(response).await;
|
let added: AddResponse = decode(response).await;
|
||||||
assert!(added.success);
|
assert!(added.success);
|
||||||
assert!(added.id.starts_with("local-"), "offline add uses a local id");
|
assert!(
|
||||||
|
added.id.starts_with("local-"),
|
||||||
|
"offline add uses a local id"
|
||||||
|
);
|
||||||
let markdown = rules_root.join(format!("{}.md", added.id));
|
let markdown = rules_root.join(format!("{}.md", added.id));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
std::fs::read_to_string(&markdown).unwrap(),
|
std::fs::read_to_string(&markdown).unwrap(),
|
||||||
|
|||||||
Reference in New Issue
Block a user