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