mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
new pipethru mechanism
This commit is contained in:
@@ -160,6 +160,8 @@ async fn get_token_state(session_id: &str) -> TokenState {
|
||||
accumulated_input_tokens: session.accumulated_input_tokens.unwrap_or(0),
|
||||
accumulated_output_tokens: session.accumulated_output_tokens.unwrap_or(0),
|
||||
accumulated_total_tokens: session.accumulated_total_tokens.unwrap_or(0),
|
||||
accumulated_cache_read_input_tokens: session.accumulated_cache_read_input_tokens.unwrap_or(0),
|
||||
accumulated_cache_write_input_tokens: session.accumulated_cache_write_input_tokens.unwrap_or(0),
|
||||
})
|
||||
.inspect_err(|e| {
|
||||
tracing::warn!(
|
||||
|
||||
@@ -720,6 +720,8 @@ pub struct TokenState {
|
||||
pub accumulated_input_tokens: i32,
|
||||
pub accumulated_output_tokens: i32,
|
||||
pub accumulated_total_tokens: i32,
|
||||
pub accumulated_cache_read_input_tokens: i32,
|
||||
pub accumulated_cache_write_input_tokens: i32,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
+11
-1
@@ -4556,9 +4556,19 @@
|
||||
"totalTokens",
|
||||
"accumulatedInputTokens",
|
||||
"accumulatedOutputTokens",
|
||||
"accumulatedTotalTokens"
|
||||
"accumulatedTotalTokens",
|
||||
"accumulatedCacheReadInputTokens",
|
||||
"accumulatedCacheWriteInputTokens"
|
||||
],
|
||||
"properties": {
|
||||
"accumulatedCacheReadInputTokens": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"accumulatedCacheWriteInputTokens": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"accumulatedInputTokens": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
|
||||
@@ -795,6 +795,8 @@ export type ThinkingContent = {
|
||||
};
|
||||
|
||||
export type TokenState = {
|
||||
accumulatedCacheReadInputTokens: number;
|
||||
accumulatedCacheWriteInputTokens: number;
|
||||
accumulatedInputTokens: number;
|
||||
accumulatedOutputTokens: number;
|
||||
accumulatedTotalTokens: number;
|
||||
|
||||
@@ -456,8 +456,10 @@ function BaseChatContent({
|
||||
accumulatedOutputTokens={
|
||||
tokenState?.accumulatedOutputTokens || sessionOutputTokens || localOutputTokens
|
||||
}
|
||||
cacheReadTokens={sessionCacheReadTokens}
|
||||
cacheWriteTokens={sessionCacheWriteTokens}
|
||||
cacheReadTokens={tokenState?.accumulatedCacheReadInputTokens || sessionCacheReadTokens}
|
||||
cacheWriteTokens={
|
||||
tokenState?.accumulatedCacheWriteInputTokens || sessionCacheWriteTokens
|
||||
}
|
||||
droppedFiles={droppedFiles}
|
||||
onFilesProcessed={() => setDroppedFiles([])} // Clear dropped files after processing
|
||||
messages={messages}
|
||||
|
||||
@@ -185,6 +185,8 @@ export function useChatStream({
|
||||
accumulatedInputTokens: 0,
|
||||
accumulatedOutputTokens: 0,
|
||||
accumulatedTotalTokens: 0,
|
||||
accumulatedCacheReadInputTokens: 0,
|
||||
accumulatedCacheWriteInputTokens: 0,
|
||||
});
|
||||
const abortControllerRef = useRef<AbortController | null>(null);
|
||||
|
||||
|
||||
@@ -207,6 +207,8 @@ export function useMessageStream({
|
||||
accumulatedInputTokens: 0,
|
||||
accumulatedOutputTokens: 0,
|
||||
accumulatedTotalTokens: 0,
|
||||
accumulatedCacheReadInputTokens: 0,
|
||||
accumulatedCacheWriteInputTokens: 0,
|
||||
});
|
||||
|
||||
// expose a way to update the body so we can update the session id when CLE occurs
|
||||
|
||||
Reference in New Issue
Block a user