Skip to content

upload more file types #616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/grumpy-bugs-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": minor
---

Allow upload of more file types ('txt', 'json', 'log', 'md', 'docx', 'ipynb', 'pdf', 'xml')
1 change: 1 addition & 0 deletions packages/types/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const clineMessageSchema = z.object({
say: clineSaySchema.optional(),
text: z.string().optional(),
images: z.array(z.string()).optional(),
files: z.array(z.string()).optional(),
partial: z.boolean().optional(),
reasoning: z.string().optional(),
conversationHistoryIndex: z.number().optional(),
Expand Down
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core/assistant-message/presentAssistantMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export async function presentAssistantMessage(cline: Task) {
}
}

await cline.say("text", content, undefined, block.partial)
await cline.say("text", content, undefined, undefined, block.partial) // kilocode_change
break
}
case "tool_use":
Expand Down
2 changes: 1 addition & 1 deletion src/core/checkpoints/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function getCheckpointService(cline: Task) {
provider?.postMessageToWebview({ type: "currentCheckpointUpdated", text: to })

cline
.say("checkpoint_saved", to, undefined, undefined, { isFirst, from, to }, undefined, {
.say("checkpoint_saved", to, undefined, undefined, undefined, { isFirst, from, to }, undefined, {
isNonInteractive: true,
})
.catch((err) => {
Expand Down
23 changes: 18 additions & 5 deletions src/core/prompts/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,31 @@ Otherwise, if you have not completed the task and do not need additional informa
invalidMcpToolArgumentError: (serverName: string, toolName: string) =>
`Invalid JSON argument used with ${serverName} for ${toolName}. Please retry with a properly formatted JSON argument.`,

// kilocode_change start
toolResult: (
text: string,
images?: string[],
fileString?: string,
): string | Array<Anthropic.TextBlockParam | Anthropic.ImageBlockParam> => {
let toolResultOutput = []

if (!(images && images.length > 0) && !fileString) {
return text
}

const textBlock: Anthropic.TextBlockParam = { type: "text", text }
toolResultOutput.push(textBlock)
if (images && images.length > 0) {
const textBlock: Anthropic.TextBlockParam = { type: "text", text }
const imageBlocks: Anthropic.ImageBlockParam[] = formatImagesIntoBlocks(images)
// Placing images after text leads to better results
return [textBlock, ...imageBlocks]
} else {
return text
toolResultOutput.push(...imageBlocks)
}

if (fileString) {
const fileBlock: Anthropic.TextBlockParam = { type: "text", text: fileString }
toolResultOutput.push(fileBlock)
}
return toolResultOutput
// kilocode_change end
},

imageBlocks: (images?: string[]): Anthropic.ImageBlockParam[] => {
Expand Down
Loading
Loading