|
73 | 73 | } |
74 | 74 |
|
75 | 75 | $: models = selectedModels.map((id) => $_models.find((m) => m.id === id)); |
| 76 | +
|
| 77 | + // True when viewing a shared folder the current user doesn't own |
| 78 | + $: folderReadOnly = $selectedFolder != null && $selectedFolder.user_id !== $user?.id; |
76 | 79 | </script> |
77 | 80 |
|
78 | 81 | <div class="m-auto w-full max-w-6xl px-2 @2xl:px-20 translate-y-6 py-24 text-center"> |
|
94 | 97 | <div class="w-full flex flex-col justify-center items-center"> |
95 | 98 | {#if $selectedFolder} |
96 | 99 | <FolderTitle |
97 | | - folder={$selectedFolder} |
98 | | - onUpdate={async (folder) => { |
99 | | - await chats.set(await getChatList(localStorage.token, $currentChatPage)); |
100 | | - currentChatPage.set(1); |
101 | | - }} |
102 | | - onDelete={async () => { |
103 | | - await chats.set(await getChatList(localStorage.token, $currentChatPage)); |
104 | | - currentChatPage.set(1); |
| 100 | + folder={$selectedFolder} |
| 101 | + readOnly={folderReadOnly} |
| 102 | + onUpdate={async (folder) => { |
| 103 | + await chats.set(await getChatList(localStorage.token, $currentChatPage)); |
| 104 | + currentChatPage.set(1); |
| 105 | + }} |
| 106 | + onDelete={async () => { |
| 107 | + await chats.set(await getChatList(localStorage.token, $currentChatPage)); |
| 108 | + currentChatPage.set(1); |
105 | 109 |
|
106 | | - selectedFolder.set(null); |
107 | | - }} |
108 | | - /> |
| 110 | + selectedFolder.set(null); |
| 111 | + }} |
| 112 | + /> |
109 | 113 | {:else} |
110 | 114 | <div class="flex flex-row justify-center gap-2.5 @sm:gap-3 w-fit px-5 max-w-xl"> |
111 | 115 | <div class="flex shrink-0 justify-center"> |
|
210 | 214 | {/if} |
211 | 215 |
|
212 | 216 | <div class="text-base font-normal @md:max-w-3xl w-full py-3 {atSelectedModel ? 'mt-2' : ''}"> |
213 | | - <MessageInput |
214 | | - bind:this={messageInput} |
215 | | - {history} |
216 | | - {selectedModels} |
217 | | - bind:files |
218 | | - bind:prompt |
219 | | - bind:autoScroll |
220 | | - bind:selectedToolIds |
221 | | - bind:selectedSkillIds |
222 | | - bind:selectedFilterIds |
223 | | - bind:imageGenerationEnabled |
224 | | - bind:codeInterpreterEnabled |
225 | | - bind:webSearchEnabled |
226 | | - bind:atSelectedModel |
227 | | - bind:showCommands |
228 | | - bind:dragged |
229 | | - {pendingOAuthTools} |
230 | | - {toolServers} |
231 | | - {stopResponse} |
232 | | - {createMessagePair} |
233 | | - placeholder={$i18n.t('How can I help you today?')} |
234 | | - {onChange} |
235 | | - {onUpload} |
236 | | - on:submit={(e) => { |
237 | | - dispatch('submit', e.detail); |
238 | | - }} |
239 | | - /> |
| 217 | + {#if !($selectedFolder && folderReadOnly)} |
| 218 | + <MessageInput |
| 219 | + bind:this={messageInput} |
| 220 | + {history} |
| 221 | + {selectedModels} |
| 222 | + bind:files |
| 223 | + bind:prompt |
| 224 | + bind:autoScroll |
| 225 | + bind:selectedToolIds |
| 226 | + bind:selectedSkillIds |
| 227 | + bind:selectedFilterIds |
| 228 | + bind:imageGenerationEnabled |
| 229 | + bind:codeInterpreterEnabled |
| 230 | + bind:webSearchEnabled |
| 231 | + bind:atSelectedModel |
| 232 | + bind:showCommands |
| 233 | + bind:dragged |
| 234 | + {pendingOAuthTools} |
| 235 | + {toolServers} |
| 236 | + {stopResponse} |
| 237 | + {createMessagePair} |
| 238 | + placeholder={$i18n.t('How can I help you today?')} |
| 239 | + {onChange} |
| 240 | + {onUpload} |
| 241 | + on:submit={(e) => { |
| 242 | + dispatch('submit', e.detail); |
| 243 | + }} |
| 244 | + /> |
| 245 | + {/if} |
240 | 246 | </div> |
241 | 247 | </div> |
242 | 248 | </div> |
|
0 commit comments