|
|
|
@ -515,14 +515,6 @@ export function Chat() {
|
|
|
|
{ leading: true, trailing: true },
|
|
|
|
{ leading: true, trailing: true },
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const onPromptSelect = (prompt: Prompt) => {
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
setPromptHints([]);
|
|
|
|
|
|
|
|
setUserInput(prompt.content);
|
|
|
|
|
|
|
|
inputRef.current?.focus();
|
|
|
|
|
|
|
|
}, 30);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// auto grow input
|
|
|
|
// auto grow input
|
|
|
|
const [inputRows, setInputRows] = useState(2);
|
|
|
|
const [inputRows, setInputRows] = useState(2);
|
|
|
|
const measure = useDebouncedCallback(
|
|
|
|
const measure = useDebouncedCallback(
|
|
|
|
@ -595,6 +587,23 @@ export function Chat() {
|
|
|
|
setAutoScroll(true);
|
|
|
|
setAutoScroll(true);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onPromptSelect = (prompt: Prompt) => {
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
setPromptHints([]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const matchedChatCommand = chatCommands.match(prompt.content);
|
|
|
|
|
|
|
|
if (matchedChatCommand.matched) {
|
|
|
|
|
|
|
|
// if user is selecting a chat command, just trigger it
|
|
|
|
|
|
|
|
matchedChatCommand.invoke();
|
|
|
|
|
|
|
|
setUserInput("");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// or fill the prompt
|
|
|
|
|
|
|
|
setUserInput(prompt.content);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
inputRef.current?.focus();
|
|
|
|
|
|
|
|
}, 30);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// stop response
|
|
|
|
// stop response
|
|
|
|
const onUserStop = (messageId: number) => {
|
|
|
|
const onUserStop = (messageId: number) => {
|
|
|
|
ChatControllerPool.stop(sessionIndex, messageId);
|
|
|
|
ChatControllerPool.stop(sessionIndex, messageId);
|
|
|
|
|