summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/atCommandProcessor.ts
diff options
context:
space:
mode:
authorJacob Richman <[email protected]>2025-05-20 13:02:41 -0700
committerGitHub <[email protected]>2025-05-20 13:02:41 -0700
commit716f7875a2fe4cec5433f64651a7f50cce58a41e (patch)
treeb440d482e12bc7efb55a9a813a7c4f6b67e3a117 /packages/cli/src/ui/hooks/atCommandProcessor.ts
parent4002e980d9e02e973e19226dbc25aeec00a65cf5 (diff)
Support Images and PDFs (#447)
Diffstat (limited to 'packages/cli/src/ui/hooks/atCommandProcessor.ts')
-rw-r--r--packages/cli/src/ui/hooks/atCommandProcessor.ts21
1 files changed, 15 insertions, 6 deletions
diff --git a/packages/cli/src/ui/hooks/atCommandProcessor.ts b/packages/cli/src/ui/hooks/atCommandProcessor.ts
index e2934840..a5b602ad 100644
--- a/packages/cli/src/ui/hooks/atCommandProcessor.ts
+++ b/packages/cli/src/ui/hooks/atCommandProcessor.ts
@@ -6,7 +6,7 @@
import * as fs from 'fs/promises';
import * as path from 'path';
-import { PartListUnion } from '@google/genai';
+import { PartListUnion, PartUnion } from '@google/genai';
import {
Config,
getErrorMessage,
@@ -126,6 +126,7 @@ export async function handleAtCommand({
}
const contentLabel = pathPart;
+
const toolRegistry = config.getToolRegistry();
const readManyFilesTool = toolRegistry.getTool('read_many_files');
@@ -168,7 +169,6 @@ export async function handleAtCommand({
try {
const result = await readManyFilesTool.execute(toolArgs, signal);
- const fileContent = result.llmContent || '';
toolCallDisplay = {
callId: `client-read-${userMessageTimestamp}`,
@@ -180,13 +180,22 @@ export async function handleAtCommand({
};
// Prepare the query parts for the LLM
- const processedQueryParts = [];
+ const processedQueryParts: PartUnion[] = [];
if (textBefore) {
processedQueryParts.push({ text: textBefore });
}
- processedQueryParts.push({
- text: `\n--- Content from: ${contentLabel} ---\n${fileContent}\n--- End Content ---`,
- });
+
+ // Process the result from the tool
+ processedQueryParts.push('\n--- Content from: ${contentLabel} ---\n');
+ if (Array.isArray(result.llmContent)) {
+ for (const part of result.llmContent) {
+ processedQueryParts.push(part);
+ }
+ } else {
+ processedQueryParts.push(result.llmContent);
+ }
+ processedQueryParts.push('\n--- End of content ---\n');
+
if (textAfter) {
processedQueryParts.push({ text: textAfter });
}