mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-12-01 01:05:10 +08:00
feat: NormalizedProvider
This commit is contained in:
1 parent
5f87357681
commit
081e1f50e2
8 files changed
+169
-14
No files matched your search
@@ -0,0 +1,28 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
use crate::model::{normalize_provider_tool_call_ids, ModelInvocation};
|
||||
|
||||
use super::{Provider, ProviderStream};
|
||||
|
||||
pub(super) struct NormalizedProvider {
|
||||
inner: Arc<dyn Provider>,
|
||||
}
|
||||
|
||||
impl NormalizedProvider {
|
||||
pub(super) fn new(inner: Arc<dyn Provider>) -> Self {
|
||||
Self { inner }
|
||||
}
|
||||
}
|
||||
|
||||
impl Provider for NormalizedProvider {
|
||||
fn stream(
|
||||
&self,
|
||||
mut invocation: ModelInvocation,
|
||||
cancellation: CancellationToken,
|
||||
) -> ProviderStream {
|
||||
normalize_provider_tool_call_ids(&mut invocation.request.history);
|
||||
self.inner.stream(invocation, cancellation)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user