Disable chat input suggested actions during streaming (#157)
This commit is contained in:
@@ -362,7 +362,7 @@ export function ChatInput({ chatId }: { chatId?: number }) {
|
|||||||
function SummarizeInNewChatButton() {
|
function SummarizeInNewChatButton() {
|
||||||
const chatId = useAtomValue(selectedChatIdAtom);
|
const chatId = useAtomValue(selectedChatIdAtom);
|
||||||
const appId = useAtomValue(selectedAppIdAtom);
|
const appId = useAtomValue(selectedAppIdAtom);
|
||||||
const { streamMessage } = useStreamChat();
|
const { streamMessage, isStreaming } = useStreamChat();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const onClick = async () => {
|
const onClick = async () => {
|
||||||
if (!appId) {
|
if (!appId) {
|
||||||
@@ -385,7 +385,12 @@ function SummarizeInNewChatButton() {
|
|||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button variant="outline" size="sm" onClick={onClick}>
|
<Button
|
||||||
|
disabled={isStreaming}
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
Summarize to new chat
|
Summarize to new chat
|
||||||
</Button>
|
</Button>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
@@ -399,12 +404,13 @@ function SummarizeInNewChatButton() {
|
|||||||
|
|
||||||
function RefactorFileButton({ path }: { path: string }) {
|
function RefactorFileButton({ path }: { path: string }) {
|
||||||
const chatId = useAtomValue(selectedChatIdAtom);
|
const chatId = useAtomValue(selectedChatIdAtom);
|
||||||
const { streamMessage } = useStreamChat();
|
const { streamMessage, isStreaming } = useStreamChat();
|
||||||
return (
|
return (
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
|
disabled={isStreaming}
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -434,12 +440,13 @@ function RefactorFileButton({ path }: { path: string }) {
|
|||||||
|
|
||||||
function WriteCodeProperlyButton() {
|
function WriteCodeProperlyButton() {
|
||||||
const chatId = useAtomValue(selectedChatIdAtom);
|
const chatId = useAtomValue(selectedChatIdAtom);
|
||||||
const { streamMessage } = useStreamChat();
|
const { streamMessage, isStreaming } = useStreamChat();
|
||||||
return (
|
return (
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
|
disabled={isStreaming}
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -470,6 +477,7 @@ function WriteCodeProperlyButton() {
|
|||||||
|
|
||||||
function RebuildButton() {
|
function RebuildButton() {
|
||||||
const { restartApp } = useRunApp();
|
const { restartApp } = useRunApp();
|
||||||
|
const { isStreaming } = useStreamChat();
|
||||||
const posthog = usePostHog();
|
const posthog = usePostHog();
|
||||||
const selectedAppId = useAtomValue(selectedAppIdAtom);
|
const selectedAppId = useAtomValue(selectedAppIdAtom);
|
||||||
|
|
||||||
@@ -484,7 +492,12 @@ function RebuildButton() {
|
|||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button variant="outline" size="sm" onClick={handleRebuild}>
|
<Button
|
||||||
|
disabled={isStreaming}
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={handleRebuild}
|
||||||
|
>
|
||||||
Rebuild app
|
Rebuild app
|
||||||
</Button>
|
</Button>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
@@ -497,6 +510,7 @@ function RebuildButton() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function RestartButton() {
|
function RestartButton() {
|
||||||
|
const { isStreaming } = useStreamChat();
|
||||||
const { restartApp } = useRunApp();
|
const { restartApp } = useRunApp();
|
||||||
const posthog = usePostHog();
|
const posthog = usePostHog();
|
||||||
const selectedAppId = useAtomValue(selectedAppIdAtom);
|
const selectedAppId = useAtomValue(selectedAppIdAtom);
|
||||||
@@ -512,7 +526,12 @@ function RestartButton() {
|
|||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button variant="outline" size="sm" onClick={handleRestart}>
|
<Button
|
||||||
|
disabled={isStreaming}
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={handleRestart}
|
||||||
|
>
|
||||||
Restart app
|
Restart app
|
||||||
</Button>
|
</Button>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
@@ -526,6 +545,7 @@ function RestartButton() {
|
|||||||
|
|
||||||
function RefreshButton() {
|
function RefreshButton() {
|
||||||
const { refreshAppIframe } = useRunApp();
|
const { refreshAppIframe } = useRunApp();
|
||||||
|
const { isStreaming } = useStreamChat();
|
||||||
const posthog = usePostHog();
|
const posthog = usePostHog();
|
||||||
|
|
||||||
const handleRefresh = useCallback(() => {
|
const handleRefresh = useCallback(() => {
|
||||||
@@ -537,7 +557,12 @@ function RefreshButton() {
|
|||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button variant="outline" size="sm" onClick={handleRefresh}>
|
<Button
|
||||||
|
disabled={isStreaming}
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={handleRefresh}
|
||||||
|
>
|
||||||
Refresh app
|
Refresh app
|
||||||
</Button>
|
</Button>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
|
|||||||
Reference in New Issue
Block a user