mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 20:50:34 +00:00
refactor(cli): Centralize history management via useHistoryManager hook (#261)
This commit is contained in:
parent
adeda6a5b3
commit
7d13f24288
7 changed files with 293 additions and 455 deletions
|
|
@ -27,6 +27,7 @@ import { HistoryItemDisplay } from './components/HistoryItemDisplay.js';
|
|||
import { useCompletion } from './hooks/useCompletion.js';
|
||||
import { SuggestionsDisplay } from './components/SuggestionsDisplay.js';
|
||||
import { isAtCommand, isSlashCommand } from './utils/commandUtils.js';
|
||||
import { useHistory } from './hooks/useHistoryManager.js';
|
||||
|
||||
interface AppProps {
|
||||
config: Config;
|
||||
|
|
@ -35,7 +36,7 @@ interface AppProps {
|
|||
}
|
||||
|
||||
export const App = ({ config, settings, cliVersion }: AppProps) => {
|
||||
const [history, setHistory] = useState<HistoryItem[]>([]);
|
||||
const { history, addItem, updateItem, clearItems } = useHistory();
|
||||
const [startupWarnings, setStartupWarnings] = useState<string[]>([]);
|
||||
const [showHelp, setShowHelp] = useState<boolean>(false);
|
||||
const {
|
||||
|
|
@ -57,7 +58,9 @@ export const App = ({ config, settings, cliVersion }: AppProps) => {
|
|||
debugMessage,
|
||||
slashCommands,
|
||||
} = useGeminiStream(
|
||||
setHistory,
|
||||
addItem,
|
||||
updateItem,
|
||||
clearItems,
|
||||
refreshStatic,
|
||||
setShowHelp,
|
||||
config,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue