File tree Expand file tree Collapse file tree 5 files changed +24
-7
lines changed
Expand file tree Collapse file tree 5 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -257,11 +257,14 @@ export class ChatPanel implements vscode.WebviewViewProvider {
257257 const sesssion = await supabase . auth . getSession ( ) ;
258258 const userLoggined = sesssion . data . session ? true : false ;
259259
260- const chatEnabled =
261- ( localChatUsing && chatServerIsWorking ) || ( cloudUsing && cloudChatUsing ) ;
260+ const chatEnabled = localChatUsing || ( cloudUsing && cloudChatUsing ) ;
261+ const chatIsWorking =
262+ ( cloudUsing && cloudChatUsing && userLoggined ) ||
263+ ( chatServerIsWorking && localChatUsing ) ;
262264
263265 return {
264266 chatEnabled : chatEnabled ,
267+ chatIsWorking : chatIsWorking ,
265268 userLoggined : userLoggined ,
266269 } ;
267270 }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { vscode } from "../utilities/vscode";
44type ConfigurationType = {
55 chatEnabled : boolean ;
66 userLoggined : boolean ;
7+ chatIsWorking : boolean ;
78} ;
89
910interface SettingsContextType {
@@ -26,19 +27,21 @@ export const SettingsProvider = ({
2627 const settings = await vscode . getSettings ( ) ;
2728 if (
2829 settings . chatEnabled !== lastSettings ?. chatEnabled ||
30+ settings . chatIsWorking !== lastSettings ?. chatIsWorking ||
2931 settings . userLoggined !== lastSettings ?. userLoggined
3032 ) {
3133 lastSettings = settings ;
3234
3335 setConfiguration ( {
3436 chatEnabled : settings . chatEnabled ,
37+ chatIsWorking : settings . chatIsWorking ,
3538 userLoggined : settings . userLoggined ,
3639 } ) ;
3740 }
3841 } ;
3942 getSettings ( ) ;
4043
41- const interval = setInterval ( getSettings , 5000 ) ;
44+ const interval = setInterval ( getSettings , 1000 ) ;
4245 return ( ) => {
4346 clearInterval ( interval ) ;
4447 } ;
Original file line number Diff line number Diff line change @@ -7,9 +7,10 @@ import { useMessageListener } from "../../hooks/messageListener";
77import TextArea from "../../components/text-area" ;
88import { useChat } from "../../hooks/useChat" ;
99import styles from "./style.module.css" ;
10+ import { useSettings } from "../../hooks/useSettings" ;
1011
1112export const ChatInstance = ( ) => {
12- let { chatId } = useParams ( ) as { chatId ?: string } ;
13+ const { chatId } = useParams ( ) as { chatId ?: string } ;
1314
1415 const {
1516 handleSubmit,
@@ -21,6 +22,8 @@ export const ChatInstance = () => {
2122 stop,
2223 } = useChat ( chatId === "new-chat" ? undefined : chatId ) ;
2324
25+ const settings = useSettings ( ) ;
26+
2427 useMessageListener ( "start-new-chat" , ( ) => {
2528 startNewChat ( ) ;
2629 } ) ;
@@ -59,15 +62,22 @@ export const ChatInstance = () => {
5962 < TextArea
6063 value = { input }
6164 onChange = { ( value ) => setInput ( value || "" ) }
62- onSubmit = { handleSubmit }
65+ onSubmit = {
66+ settings . configuration . chatIsWorking ? handleSubmit : ( ) => true
67+ }
6368 buttonEnd = {
6469 < VSCodeButton
6570 appearance = "icon"
71+ disabled = { ! settings . configuration . chatIsWorking }
6672 onClick = { isLoading ? stop : handleSubmit }
6773 >
6874 < span
6975 className = { `codicon ${
70- isLoading ? "codicon-debug-stop" : "codicon-send"
76+ settings . configuration . chatIsWorking
77+ ? isLoading
78+ ? "codicon-debug-stop"
79+ : "codicon-send"
80+ : "codicon-loading codicon-modifier-spin"
7181 } `}
7282 > </ span >
7383 </ VSCodeButton >
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { Navigate, Outlet } from "react-router-dom";
22import { useSettings } from "../../hooks/useSettings" ;
33
44export function RequireInit ( ) {
5- let settings = useSettings ( ) ;
5+ const settings = useSettings ( ) ;
66
77 if ( ! settings . configuration . chatEnabled ) {
88 return < Navigate to = "/init" /> ;
Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ class VSCodeAPIWrapper {
163163 public getSettings ( ) {
164164 return new Promise < {
165165 chatEnabled : boolean ;
166+ chatIsWorking : boolean ;
166167 userLoggined : boolean ;
167168 } > ( ( resolve ) => {
168169 this . postMessageCallback (
You can’t perform that action at this time.
0 commit comments