refactor: remove unused props clearItems, openThemeDialog, onSubmit (#357)
This commit is contained in:
parent
39d57ead1a
commit
c6bca64499
|
@ -127,12 +127,10 @@ export const App = ({
|
|||
const { streamingState, submitQuery, initError, pendingHistoryItem } =
|
||||
useGeminiStream(
|
||||
addItem,
|
||||
clearItems,
|
||||
refreshStatic,
|
||||
setShowHelp,
|
||||
config,
|
||||
setDebugMessage,
|
||||
openThemeDialog,
|
||||
handleSlashCommand,
|
||||
);
|
||||
const { elapsedTime, currentLoadingPhrase } =
|
||||
|
@ -230,7 +228,6 @@ export const App = ({
|
|||
<HistoryItemDisplay
|
||||
key={'history-' + historyItem.id}
|
||||
item={historyItem}
|
||||
onSubmit={submitQuery}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
|
@ -240,7 +237,6 @@ export const App = ({
|
|||
// TODO(taehykim): It seems like references to ids aren't necessary in
|
||||
// HistoryItemDisplay. Refactor later. Use a fake id for now.
|
||||
item={{ ...pendingHistoryItem, id: 0 }}
|
||||
onSubmit={submitQuery}
|
||||
/>
|
||||
)}
|
||||
{showHelp && <Help commands={slashCommands} />}
|
||||
|
|
|
@ -11,18 +11,15 @@ import { GeminiMessage } from './messages/GeminiMessage.js';
|
|||
import { InfoMessage } from './messages/InfoMessage.js';
|
||||
import { ErrorMessage } from './messages/ErrorMessage.js';
|
||||
import { ToolGroupMessage } from './messages/ToolGroupMessage.js';
|
||||
import { PartListUnion } from '@google/genai';
|
||||
import { GeminiMessageContent } from './messages/GeminiMessageContent.js';
|
||||
import { Box } from 'ink';
|
||||
|
||||
interface HistoryItemDisplayProps {
|
||||
item: HistoryItem;
|
||||
onSubmit: (value: PartListUnion) => void;
|
||||
}
|
||||
|
||||
export const HistoryItemDisplay: React.FC<HistoryItemDisplayProps> = ({
|
||||
item,
|
||||
onSubmit,
|
||||
}) => (
|
||||
<Box flexDirection="column" key={item.id}>
|
||||
{/* Render standard message types */}
|
||||
|
@ -34,11 +31,7 @@ export const HistoryItemDisplay: React.FC<HistoryItemDisplayProps> = ({
|
|||
{item.type === 'info' && <InfoMessage text={item.text} />}
|
||||
{item.type === 'error' && <ErrorMessage text={item.text} />}
|
||||
{item.type === 'tool_group' && (
|
||||
<ToolGroupMessage
|
||||
toolCalls={item.tools}
|
||||
groupId={item.id}
|
||||
onSubmit={onSubmit}
|
||||
/>
|
||||
<ToolGroupMessage toolCalls={item.tools} groupId={item.id} />
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
import React from 'react';
|
||||
import { Box, Text, useInput } from 'ink';
|
||||
import { PartListUnion } from '@google/genai';
|
||||
import { DiffRenderer } from './DiffRenderer.js';
|
||||
import { Colors } from '../../colors.js';
|
||||
import {
|
||||
|
@ -22,7 +21,6 @@ import {
|
|||
|
||||
export interface ToolConfirmationMessageProps {
|
||||
confirmationDetails: ToolCallConfirmationDetails;
|
||||
onSubmit: (value: PartListUnion) => void;
|
||||
}
|
||||
|
||||
function isEditDetails(
|
||||
|
|
|
@ -8,21 +8,18 @@ import React from 'react';
|
|||
import { Box } from 'ink';
|
||||
import { IndividualToolCallDisplay, ToolCallStatus } from '../../types.js';
|
||||
import { ToolMessage } from './ToolMessage.js';
|
||||
import { PartListUnion } from '@google/genai';
|
||||
import { ToolConfirmationMessage } from './ToolConfirmationMessage.js';
|
||||
import { Colors } from '../../colors.js';
|
||||
|
||||
interface ToolGroupMessageProps {
|
||||
groupId: number;
|
||||
toolCalls: IndividualToolCallDisplay[];
|
||||
onSubmit: (value: PartListUnion) => void;
|
||||
}
|
||||
|
||||
// Main component renders the border and maps the tools using ToolMessage
|
||||
export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
||||
groupId,
|
||||
toolCalls,
|
||||
onSubmit,
|
||||
}) => {
|
||||
const hasPending = !toolCalls.every(
|
||||
(t) => t.status === ToolCallStatus.Success,
|
||||
|
@ -61,7 +58,6 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
|||
tool.confirmationDetails && (
|
||||
<ToolConfirmationMessage
|
||||
confirmationDetails={tool.confirmationDetails}
|
||||
onSubmit={onSubmit}
|
||||
></ToolConfirmationMessage>
|
||||
)}
|
||||
</Box>
|
||||
|
|
|
@ -55,12 +55,10 @@ enum StreamProcessingStatus {
|
|||
*/
|
||||
export const useGeminiStream = (
|
||||
addItem: UseHistoryManagerReturn['addItem'],
|
||||
_clearItems: UseHistoryManagerReturn['clearItems'],
|
||||
refreshStatic: () => void,
|
||||
setShowHelp: React.Dispatch<React.SetStateAction<boolean>>,
|
||||
config: Config,
|
||||
onDebugMessage: (message: string) => void,
|
||||
_openThemeDialog: () => void,
|
||||
handleSlashCommand: (cmd: PartListUnion) => boolean,
|
||||
) => {
|
||||
const toolRegistry = config.getToolRegistry();
|
||||
|
|
Loading…
Reference in New Issue