mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-12-01 01:05:10 +08:00
feat: add Brazilian Portuguese locale and configurable token pricing
Enable Portuguese-speaking users with full pt-BR translations and let users set per-million token rates so home cost estimates reflect their actual pricing. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3b37c33607
commit
0ce64e20ba
16 files changed
+1133
-176
No files matched your search
@@ -216,6 +216,10 @@ pub fn api_router(service: ControlService) -> Router {
|
||||
"/__byok-api__/api/settings/commit",
|
||||
get(settings::get_commit).put(settings::update_commit),
|
||||
)
|
||||
.route(
|
||||
"/__byok-api__/api/settings/pricing",
|
||||
get(settings::get_pricing_settings).put(settings::update_pricing_settings),
|
||||
)
|
||||
.route(
|
||||
"/__byok-api__/api/harness/cursor/status",
|
||||
get(harness::status),
|
||||
|
||||
@@ -29,7 +29,7 @@ use crate::{
|
||||
provider::{is_valid_response_event, ModelEvent, Provider},
|
||||
store::{
|
||||
CommitSettings, DesktopSettings, PortSettings, ProxySettings, ProxySettingsInput,
|
||||
StatisticsStorage, Store, TabSettings,
|
||||
StatisticsStorage, Store, TabSettings, TokenPricingSettings,
|
||||
},
|
||||
Error, Result,
|
||||
};
|
||||
@@ -748,6 +748,17 @@ impl ControlService {
|
||||
pub async fn set_commit_settings(&self, settings: CommitSettings) -> Result<CommitSettings> {
|
||||
self.store.set_commit_settings(settings).await
|
||||
}
|
||||
|
||||
pub async fn pricing_settings(&self) -> Result<TokenPricingSettings> {
|
||||
self.store.pricing_settings().await
|
||||
}
|
||||
|
||||
pub async fn set_pricing_settings(
|
||||
&self,
|
||||
settings: TokenPricingSettings,
|
||||
) -> Result<TokenPricingSettings> {
|
||||
self.store.set_pricing_settings(settings).await
|
||||
}
|
||||
}
|
||||
|
||||
fn official_call(trace: CursorRunTraceSummary) -> CallSummary {
|
||||
|
||||
@@ -10,6 +10,7 @@ use serde::{Deserialize, Serialize};
|
||||
use crate::store::{
|
||||
CommitPromptLocale, CommitSettings, DesktopSettings, PortSettings, ProxySettings,
|
||||
ProxySettingsInput, StatisticsStorage, StatisticsStorageScope, TabSettings,
|
||||
TokenPricingSettings,
|
||||
};
|
||||
|
||||
use super::{ControlService, ObservabilitySettings};
|
||||
@@ -134,6 +135,19 @@ pub async fn update_commit(
|
||||
Ok(Json(CommitSettingsView::new(saved, default_locale)))
|
||||
}
|
||||
|
||||
pub async fn get_pricing_settings(
|
||||
State(service): State<ControlService>,
|
||||
) -> Result<Json<TokenPricingSettings>> {
|
||||
Ok(Json(service.pricing_settings().await?))
|
||||
}
|
||||
|
||||
pub async fn update_pricing_settings(
|
||||
State(service): State<ControlService>,
|
||||
Json(settings): Json<TokenPricingSettings>,
|
||||
) -> Result<Json<TokenPricingSettings>> {
|
||||
Ok(Json(service.set_pricing_settings(settings).await?))
|
||||
}
|
||||
|
||||
fn requested_commit_locale(headers: &HeaderMap) -> CommitPromptLocale {
|
||||
match headers
|
||||
.get(header::ACCEPT_LANGUAGE)
|
||||
|
||||
Reference in new issue
Block a user