mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-12-01 01:05:10 +08:00
feat: add configurable Cursor TAB routing
This commit is contained in:
1 parent
8a4fc5076a
commit
0f23a9a9c3
23 files changed
+649
-73
No files matched your search
@@ -155,6 +155,10 @@ pub fn api_router(service: ControlService) -> Router {
|
||||
"/__byok-api__/api/settings/proxy",
|
||||
get(settings::get_proxy).put(settings::update_proxy),
|
||||
)
|
||||
.route(
|
||||
"/__byok-api__/api/settings/tab",
|
||||
get(settings::get_tab).put(settings::update_tab),
|
||||
)
|
||||
.route(
|
||||
"/__byok-api__/api/harness/cursor/status",
|
||||
get(harness::status),
|
||||
|
||||
@@ -17,7 +17,9 @@ use crate::{
|
||||
LlmCallSummary, Overview, ProviderEndpoint, ProviderEndpointInput, ProviderEndpointSecret,
|
||||
ProviderModel, ProviderModelInput, ProviderType,
|
||||
},
|
||||
store::{PortSettings, ProxySettings, ProxySettingsInput, StatisticsStorage, Store},
|
||||
store::{
|
||||
PortSettings, ProxySettings, ProxySettingsInput, StatisticsStorage, Store, TabSettings,
|
||||
},
|
||||
Error, Result,
|
||||
};
|
||||
|
||||
@@ -372,6 +374,14 @@ impl ControlService {
|
||||
pub async fn set_proxy_settings(&self, settings: ProxySettingsInput) -> Result<ProxySettings> {
|
||||
self.store.set_proxy_settings(settings).await
|
||||
}
|
||||
|
||||
pub async fn tab_settings(&self) -> Result<TabSettings> {
|
||||
self.store.tab_settings().await
|
||||
}
|
||||
|
||||
pub async fn set_tab_settings(&self, settings: TabSettings) -> Result<TabSettings> {
|
||||
self.cursor_harness.set_tab_settings(settings).await
|
||||
}
|
||||
}
|
||||
|
||||
fn official_call(trace: CursorRunTraceSummary) -> CallSummary {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
use crate::Result;
|
||||
use axum::{extract::State, Json};
|
||||
|
||||
use crate::store::{PortSettings, ProxySettings, ProxySettingsInput, StatisticsStorage};
|
||||
use crate::store::{
|
||||
PortSettings, ProxySettings, ProxySettingsInput, StatisticsStorage, TabSettings,
|
||||
};
|
||||
|
||||
use super::{ControlService, ObservabilitySettings};
|
||||
|
||||
@@ -47,3 +49,14 @@ pub async fn update_proxy(
|
||||
) -> Result<Json<ProxySettings>> {
|
||||
Ok(Json(service.set_proxy_settings(settings).await?))
|
||||
}
|
||||
|
||||
pub async fn get_tab(State(service): State<ControlService>) -> Result<Json<TabSettings>> {
|
||||
Ok(Json(service.tab_settings().await?))
|
||||
}
|
||||
|
||||
pub async fn update_tab(
|
||||
State(service): State<ControlService>,
|
||||
Json(settings): Json<TabSettings>,
|
||||
) -> Result<Json<TabSettings>> {
|
||||
Ok(Json(service.set_tab_settings(settings).await?))
|
||||
}
|
||||
Reference in new issue
Block a user