MCPcopy Index your code
hub / github.com/continuedev/continue / useChatHandlers

Function useChatHandlers

extensions/cli/src/ui/TUIChat.tsx:119–149  ·  view source on GitHub ↗
(
  setShowIntroMessage: (show: boolean) => void,
  setStaticRefreshTrigger: React.Dispatch<React.SetStateAction<number>>,
)

Source from the content-addressed store, hash-verified

117
118// Custom hook for chat handlers
119function useChatHandlers(
120 setShowIntroMessage: (show: boolean) => void,
121 setStaticRefreshTrigger: React.Dispatch<React.SetStateAction<number>>,
122) {
123 // Temporary refs to avoid circular dependency
124 const resetChatHistoryRef = useRef<(() => void) | null>(null);
125
126 // Handle clearing chat and resetting intro message
127 const handleClear = useCallback(() => {
128 setShowIntroMessage(true);
129 // Trigger static content refresh by incrementing the trigger
130 setStaticRefreshTrigger((prev) => prev + 1);
131 }, [setShowIntroMessage, setStaticRefreshTrigger]);
132
133 // Service reload handlers - these will trigger reactive updates
134 const handleReload = useCallback(async () => {
135 // Services will automatically update the UI when they reload
136 // We just need to reset chat history, intro message, and clear the screen
137 if (resetChatHistoryRef.current) {
138 resetChatHistoryRef.current();
139 }
140 setShowIntroMessage(false);
141 process.stdout.write("\x1b[2J\x1b[H");
142 }, [setShowIntroMessage]);
143
144 return {
145 handleClear,
146 handleReload,
147 resetChatHistoryRef,
148 };
149}
150
151// eslint-disable-next-line complexity
152const TUIChat: React.FC<TUIChatProps> = ({

Callers 1

TUIChatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected