Skip to content

Commit 6373bfd

Browse files
committed
delete some code
1 parent da91aa2 commit 6373bfd

File tree

4 files changed

+2
-26
lines changed

4 files changed

+2
-26
lines changed

backend/src/get-file-reading-updates.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,11 @@ import { countTokensJson } from './util/token-counter'
88
import { requestFiles } from './websockets/websocket-action'
99

1010
import type { Message } from '@codebuff/common/types/messages/codebuff-message'
11-
import type { ProjectFileContext } from '@codebuff/common/util/file'
1211
import type { WebSocket } from 'ws'
1312

14-
const getInitialFiles = (fileContext: ProjectFileContext) => {
15-
const { userKnowledgeFiles, knowledgeFiles } = fileContext
16-
return [
17-
// Include user-level knowledge files.
18-
...Object.entries(userKnowledgeFiles ?? {}).map(([path, content]) => ({
19-
path,
20-
content,
21-
})),
22-
23-
// Include top-level project knowledge files.
24-
...Object.entries(knowledgeFiles)
25-
.map(([path, content]) => ({
26-
path,
27-
content,
28-
}))
29-
// Only keep top-level knowledge files.
30-
.filter((f) => f.path.split('/').length === 1),
31-
]
32-
}
33-
3413
export async function getFileReadingUpdates(
3514
ws: WebSocket,
3615
messages: Message[],
37-
fileContext: ProjectFileContext,
3816
options: {
3917
requestedFiles?: string[]
4018
agentStepId: string
@@ -66,7 +44,6 @@ export async function getFileReadingUpdates(
6644

6745
const requestedFiles = options.requestedFiles ?? []
6846

69-
const isFirstRead = previousFileList.length === 0
7047
const allFilePaths = uniq([
7148
...requestedFiles,
7249
...editedFilePaths,

backend/src/run-agent-step.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export const runAgentStep = async (
148148
}
149149

150150
const { addedFiles, updatedFilePaths, clearReadFileToolResults } =
151-
await getFileReadingUpdates(ws, messageHistory, fileContext, {
151+
await getFileReadingUpdates(ws, messageHistory, {
152152
agentStepId,
153153
clientSessionId,
154154
fingerprintId,

backend/src/tools/handlers/tool/find-files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const handleFindFiles = ((params: {
9393

9494
if (requestedFiles && requestedFiles.length > 0) {
9595
const { addedFiles, updatedFilePaths, printedPaths } =
96-
await getFileReadingUpdates(ws, messages, fileContext, {
96+
await getFileReadingUpdates(ws, messages, {
9797
requestedFiles,
9898
agentStepId,
9999
clientSessionId,

backend/src/tools/handlers/tool/read-files.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export const handleReadFiles = ((params: {
6363
const { addedFiles, updatedFilePaths } = await getFileReadingUpdates(
6464
ws,
6565
messages,
66-
fileContext,
6766
{
6867
requestedFiles: paths,
6968
agentStepId,

0 commit comments

Comments
 (0)