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
27202735 return _chatId ;
27212736 };
27222737
2738+ const saveParamsHandler = async () => {
2739+ const _chatId = $chatId ;
2740+ if (! _chatId || $temporaryChatEnabled || loading ) return ;
2741+ await updateChatById (localStorage .token , _chatId , {
2742+ params: params
2743+ });
2744+ };
2745+
27232746 const saveChatHandler = async (_chatId , history ) => {
27242747 if ($chatId == _chatId ) {
27252748 if (! $temporaryChatEnabled ) {
You can’t perform that action at this time.
0 commit comments