Skip to content

Commit 65e24c8

Browse files
committed
fix: binary file handling
1 parent 98a7d43 commit 65e24c8

2 files changed

Lines changed: 0 additions & 87 deletions

File tree

src/electron/workers/nodeGitWorker.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,5 +265,3 @@ parentPort?.on('message', async (m: Msg) => {
265265
err((m as any).id ?? -1, e?.message ?? String(e))
266266
}
267267
})
268-
269-

src/web/src/App.tsx

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -849,91 +849,6 @@ function App() {
849849
return null
850850
}
851851

852-
// Small helper: use context to feed TokenUsage without prop-drilling
853-
function TokenUsageWithContext({
854-
filesCount,
855-
instructionsTokens,
856-
fileTreeTokens,
857-
limit,
858-
}: {
859-
filesCount: number
860-
instructionsTokens: number
861-
fileTreeTokens: number
862-
limit: number
863-
}) {
864-
const { total } = useTokenCountsContext()
865-
const src = useCallback(() => total, [total])
866-
return (
867-
<TokenUsage
868-
fileTokensTotalSource={src}
869-
filesCount={filesCount}
870-
instructionsTokens={instructionsTokens}
871-
fileTreeTokens={fileTreeTokens}
872-
limit={limit}
873-
/>
874-
)
875-
}
876-
877-
// Bridge: keeps your StatusBar messages/progress exactly as before, now fed by the context.
878-
function TokenCountingStatusBridge({
879-
includeTree,
880-
treeBusy,
881-
}: {
882-
includeTree: boolean
883-
treeBusy: boolean
884-
}) {
885-
const { busy, progress } = useTokenCountsContext()
886-
useEffect(() => {
887-
const anotherTaskLoading =
888-
appStatus.state === 'LOADING' && 'task' in appStatus && appStatus.task !== 'tokens'
889-
890-
const tokenWorkActive = busy || treeBusy
891-
const selectedWeight = includeTree ? 85 : 100
892-
const treeWeight = includeTree ? 15 : 0
893-
const selectedPortion = Math.round((Math.max(0, Math.min(100, progress.percent)) * selectedWeight) / 100)
894-
const treePortion = treeBusy ? 0 : treeWeight
895-
const overallPercent = Math.max(0, Math.min(100, selectedPortion + treePortion))
896-
897-
if (tokenWorkActive) {
898-
if (!anotherTaskLoading && currentDir !== null) {
899-
const files = selectedPaths.size
900-
const msg =
901-
files > 0
902-
? `Counting tokens for ${files.toLocaleString()} selected file${files === 1 ? '' : 's'}…`
903-
: 'Counting tokens…'
904-
setAppStatus({
905-
state: 'LOADING',
906-
task: 'tokens',
907-
message: `${msg} ${overallPercent}%`,
908-
progress: overallPercent,
909-
})
910-
try {
911-
console.info('[app-status]', {
912-
state: 'LOADING',
913-
task: 'tokens',
914-
message: `${msg} ${overallPercent}%`,
915-
progress: overallPercent,
916-
})
917-
} catch {}
918-
}
919-
} else {
920-
if (
921-
appStatus.state === 'LOADING' &&
922-
'task' in appStatus &&
923-
appStatus.task === 'tokens' &&
924-
currentDir !== null
925-
) {
926-
setAppStatus({ state: 'READY', message: 'Token counts updated.' })
927-
try {
928-
console.info('[app-status]', { state: 'READY', message: 'Token counts updated.' })
929-
} catch {}
930-
}
931-
}
932-
// eslint-disable-next-line react-hooks/exhaustive-deps
933-
}, [busy, treeBusy, progress.percent, includeTree, currentDir, selectedPaths.size])
934-
return null
935-
}
936-
937852
return (
938853
<BrowserSupportGate>
939854
<TokenCountsProvider

0 commit comments

Comments
 (0)