mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
refactor: move nested debugmessage and slashcommand hooks outside of useGeminiStream (#341)
This commit is contained in:
@@ -10,6 +10,7 @@ import { StreamingState, type HistoryItem } from './types.js';
|
||||
import { useGeminiStream } from './hooks/useGeminiStream.js';
|
||||
import { useLoadingIndicator } from './hooks/useLoadingIndicator.js';
|
||||
import { useThemeCommand } from './hooks/useThemeCommand.js';
|
||||
import { useSlashCommandProcessor } from './hooks/slashCommandProcessor.js';
|
||||
import { Header } from './components/Header.js';
|
||||
import { LoadingIndicator } from './components/LoadingIndicator.js';
|
||||
import { EditorState, InputPrompt } from './components/InputPrompt.js';
|
||||
@@ -36,36 +37,40 @@ interface AppProps {
|
||||
|
||||
export const App = ({ config, settings, cliVersion }: AppProps) => {
|
||||
const { history, addItem, clearItems } = useHistory();
|
||||
const [staticKey, setStaticKey] = useState(0);
|
||||
const refreshStatic = useCallback(() => {
|
||||
setStaticKey((prev) => prev + 1);
|
||||
}, [setStaticKey]);
|
||||
|
||||
const [startupWarnings, setStartupWarnings] = useState<string[]>([]);
|
||||
const [debugMessage, setDebugMessage] = useState<string>('');
|
||||
const [showHelp, setShowHelp] = useState<boolean>(false);
|
||||
const [themeError, setThemeError] = useState<string | null>(null);
|
||||
|
||||
const {
|
||||
isThemeDialogOpen,
|
||||
openThemeDialog,
|
||||
handleThemeSelect,
|
||||
handleThemeHighlight,
|
||||
} = useThemeCommand(settings, setThemeError);
|
||||
|
||||
const [staticKey, setStaticKey] = useState(0);
|
||||
const refreshStatic = useCallback(() => {
|
||||
setStaticKey((prev) => prev + 1);
|
||||
}, [setStaticKey]);
|
||||
|
||||
const {
|
||||
streamingState,
|
||||
submitQuery,
|
||||
initError,
|
||||
debugMessage,
|
||||
slashCommands,
|
||||
pendingHistoryItem,
|
||||
} = useGeminiStream(
|
||||
const { handleSlashCommand, slashCommands } = useSlashCommandProcessor(
|
||||
addItem,
|
||||
clearItems,
|
||||
refreshStatic,
|
||||
setShowHelp,
|
||||
config,
|
||||
setDebugMessage,
|
||||
openThemeDialog,
|
||||
);
|
||||
|
||||
const { streamingState, submitQuery, initError, pendingHistoryItem } =
|
||||
useGeminiStream(
|
||||
addItem,
|
||||
refreshStatic,
|
||||
setShowHelp,
|
||||
config,
|
||||
setDebugMessage,
|
||||
handleSlashCommand,
|
||||
);
|
||||
const { elapsedTime, currentLoadingPhrase } =
|
||||
useLoadingIndicator(streamingState);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user