File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 175175 let chatFiles = [];
176176 let files = [];
177177 let params = {};
178+ let oldParams = {};
179+ let paramsDebounceTimer: ReturnType <typeof setTimeout > | null = null ;
180+
181+ $ : if (! equal (params , oldParams )) {
182+ oldParams = structuredClone (params );
183+ if (! loading && ! $temporaryChatEnabled && $chatId ) {
184+ if (paramsDebounceTimer ) clearTimeout (paramsDebounceTimer );
185+ paramsDebounceTimer = setTimeout (saveParamsHandler , 500 );
186+ }
187+ }
178188
179189 $ : if (chatIdProp ) {
180190 navigateHandler ();
189199
190200 loading = true ;
191201
202+ if (paramsDebounceTimer ) {
203+ clearTimeout (paramsDebounceTimer );
204+ paramsDebounceTimer = null ;
205+ }
206+
192207 prompt = ' ' ;
193208 messageInput ?.setText (' ' );
194209
27232738 return _chatId ;
27242739 };
27252740
2741+ const saveParamsHandler = async () => {
2742+ const _chatId = $chatId ;
2743+ if (! _chatId || $temporaryChatEnabled || loading ) return ;
2744+ await updateChatById (localStorage .token , _chatId , {
2745+ params: params
2746+ });
2747+ };
2748+
27262749 const saveChatHandler = async (_chatId , history ) => {
27272750 if ($chatId == _chatId ) {
27282751 if (! $temporaryChatEnabled ) {
You can’t perform that action at this time.
0 commit comments