feat: update desktop settings and server compatibility

This commit is contained in:
leokun
2026-09-04 15:33:55 +08:00
parent 8942287a27
commit 17342167ac
113 changed files with 2424 additions and 19109 deletions
+7 -2
View File
@@ -20,7 +20,7 @@ use cursor_server::{
model::{ContentPart, ModelConfigInput, ModelType, ProjectedContent, OPENAI_CHAT_ENDPOINT},
network::NetworkClients,
provider::{FinishReason, ModelEvent},
store::{CommitSettings, DEFAULT_COMMIT_PROMPT},
store::{CommitPromptLocale, CommitSettings, DEFAULT_COMMIT_PROMPT_ZH_CN},
};
use tower::ServiceExt;
@@ -101,6 +101,7 @@ async fn commit_message_is_generated_through_configured_model() {
.set_commit_settings(CommitSettings {
model_id: created.model_hash.clone(),
prompt: String::new(),
prompt_locale: CommitPromptLocale::ZhCn,
})
.await
.unwrap();
@@ -124,7 +125,7 @@ async fn commit_message_is_generated_through_configured_model() {
assert_eq!(requests.len(), 1);
assert_eq!(
requests[0].prompt.instructions,
DEFAULT_COMMIT_PROMPT.trim()
DEFAULT_COMMIT_PROMPT_ZH_CN.trim()
);
let ProjectedContent::Parts(parts) = &requests[0].history[0].content else {
panic!("expected user text parts");
@@ -147,6 +148,7 @@ async fn custom_prompt_and_model_from_commit_settings_are_used() {
.set_commit_settings(CommitSettings {
model_id: created.model_hash,
prompt: "自定义提交提示词".into(),
prompt_locale: CommitPromptLocale::ZhCn,
})
.await
.unwrap();
@@ -180,6 +182,7 @@ async fn empty_diffs_are_rejected_when_generating() {
.set_commit_settings(CommitSettings {
model_id: created.model_hash,
prompt: String::new(),
prompt_locale: CommitPromptLocale::ZhCn,
})
.await
.unwrap();
@@ -205,6 +208,7 @@ async fn tool_call_events_are_rejected() {
.set_commit_settings(CommitSettings {
model_id: created.model_hash,
prompt: String::new(),
prompt_locale: CommitPromptLocale::ZhCn,
})
.await
.unwrap();
@@ -231,6 +235,7 @@ async fn unconfigured_model_is_rejected() {
.set_commit_settings(CommitSettings {
model_id: "missing-hash".into(),
prompt: String::new(),
prompt_locale: CommitPromptLocale::ZhCn,
})
.await
.unwrap();