refac
This commit is contained in:
1 parent
1111a3a222
commit
1457f2dec8
4 files changed
+92
-91
No files matched your search
@@ -3177,96 +3177,94 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if readOnly}
|
{#if readOnly}
|
||||||
<div class="pb-6 z-10">
|
<div class="pb-6 z-10">
|
||||||
<div
|
<div class="text-xs text-gray-400 dark:text-gray-500 text-center">
|
||||||
class="text-xs text-gray-400 dark:text-gray-500 text-center"
|
{$i18n.t('Read only')}
|
||||||
>
|
</div>
|
||||||
{$i18n.t('Read only')}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{:else}
|
||||||
{:else}
|
<div class=" pb-2 {dragged ? 'z-0' : 'z-10'}">
|
||||||
<div class=" pb-2 {dragged ? 'z-0' : 'z-10'}">
|
<MessageInput
|
||||||
<MessageInput
|
bind:this={messageInput}
|
||||||
bind:this={messageInput}
|
{history}
|
||||||
{history}
|
{taskIds}
|
||||||
{taskIds}
|
{selectedModels}
|
||||||
{selectedModels}
|
bind:files
|
||||||
bind:files
|
bind:prompt
|
||||||
bind:prompt
|
bind:autoScroll
|
||||||
bind:autoScroll
|
bind:selectedToolIds
|
||||||
bind:selectedToolIds
|
bind:selectedSkillIds
|
||||||
bind:selectedSkillIds
|
bind:selectedFilterIds
|
||||||
bind:selectedFilterIds
|
bind:imageGenerationEnabled
|
||||||
bind:imageGenerationEnabled
|
bind:codeInterpreterEnabled
|
||||||
bind:codeInterpreterEnabled
|
{pendingOAuthTools}
|
||||||
{pendingOAuthTools}
|
bind:webSearchEnabled
|
||||||
bind:webSearchEnabled
|
bind:atSelectedModel
|
||||||
bind:atSelectedModel
|
bind:showCommands
|
||||||
bind:showCommands
|
bind:dragged
|
||||||
bind:dragged
|
toolServers={$toolServers}
|
||||||
toolServers={$toolServers}
|
{generating}
|
||||||
{generating}
|
{stopResponse}
|
||||||
{stopResponse}
|
{createMessagePair}
|
||||||
{createMessagePair}
|
{onUpload}
|
||||||
{onUpload}
|
messageQueue={$chatRequestQueues[$chatId] ?? []}
|
||||||
messageQueue={$chatRequestQueues[$chatId] ?? []}
|
{chatTasks}
|
||||||
{chatTasks}
|
onQueueSendNow={async (id) => {
|
||||||
onQueueSendNow={async (id) => {
|
const queue = $chatRequestQueues[$chatId] ?? [];
|
||||||
const queue = $chatRequestQueues[$chatId] ?? [];
|
const item = queue.find((m) => m.id === id);
|
||||||
const item = queue.find((m) => m.id === id);
|
if (item) {
|
||||||
if (item) {
|
// Remove from queue
|
||||||
// Remove from queue
|
chatRequestQueues.update((q) => ({
|
||||||
|
...q,
|
||||||
|
[$chatId]: queue.filter((m) => m.id !== id)
|
||||||
|
}));
|
||||||
|
await stopResponse(false);
|
||||||
|
await tick();
|
||||||
|
await submitPrompt(item.prompt, item.files);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onQueueEdit={(id) => {
|
||||||
|
const queue = $chatRequestQueues[$chatId] ?? [];
|
||||||
|
const item = queue.find((m) => m.id === id);
|
||||||
|
if (item) {
|
||||||
|
// Remove from queue
|
||||||
|
chatRequestQueues.update((q) => ({
|
||||||
|
...q,
|
||||||
|
[$chatId]: queue.filter((m) => m.id !== id)
|
||||||
|
}));
|
||||||
|
// Set files and restore prompt to input
|
||||||
|
files = item.files;
|
||||||
|
messageInput?.setText(item.prompt);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onQueueDelete={(id) => {
|
||||||
|
const queue = $chatRequestQueues[$chatId] ?? [];
|
||||||
chatRequestQueues.update((q) => ({
|
chatRequestQueues.update((q) => ({
|
||||||
...q,
|
...q,
|
||||||
[$chatId]: queue.filter((m) => m.id !== id)
|
[$chatId]: queue.filter((m) => m.id !== id)
|
||||||
}));
|
}));
|
||||||
await stopResponse(false);
|
}}
|
||||||
await tick();
|
onChange={(data) => {
|
||||||
await submitPrompt(item.prompt, item.files);
|
if (!$temporaryChatEnabled) {
|
||||||
}
|
saveDraft(data, $chatId);
|
||||||
}}
|
}
|
||||||
onQueueEdit={(id) => {
|
}}
|
||||||
const queue = $chatRequestQueues[$chatId] ?? [];
|
on:submit={async (e) => {
|
||||||
const item = queue.find((m) => m.id === id);
|
clearDraft($chatId);
|
||||||
if (item) {
|
if (e.detail || files.length > 0) {
|
||||||
// Remove from queue
|
await tick();
|
||||||
chatRequestQueues.update((q) => ({
|
|
||||||
...q,
|
|
||||||
[$chatId]: queue.filter((m) => m.id !== id)
|
|
||||||
}));
|
|
||||||
// Set files and restore prompt to input
|
|
||||||
files = item.files;
|
|
||||||
messageInput?.setText(item.prompt);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onQueueDelete={(id) => {
|
|
||||||
const queue = $chatRequestQueues[$chatId] ?? [];
|
|
||||||
chatRequestQueues.update((q) => ({
|
|
||||||
...q,
|
|
||||||
[$chatId]: queue.filter((m) => m.id !== id)
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
onChange={(data) => {
|
|
||||||
if (!$temporaryChatEnabled) {
|
|
||||||
saveDraft(data, $chatId);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
on:submit={async (e) => {
|
|
||||||
clearDraft($chatId);
|
|
||||||
if (e.detail || files.length > 0) {
|
|
||||||
await tick();
|
|
||||||
|
|
||||||
submitHandler(e.detail);
|
submitHandler(e.detail);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="absolute bottom-1 text-xs text-gray-500 text-center line-clamp-1 right-0 left-0"
|
class="absolute bottom-1 text-xs text-gray-500 text-center line-clamp-1 right-0 left-0"
|
||||||
>
|
>
|
||||||
<!-- {$i18n.t('LLMs can make mistakes. Verify important information.')} -->
|
<!-- {$i18n.t('LLMs can make mistakes. Verify important information.')} -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<div class="flex items-center h-full">
|
<div class="flex items-center h-full">
|
||||||
|
|||||||
@@ -123,7 +123,11 @@
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
{#if showModelSelector}
|
{#if showModelSelector}
|
||||||
<ModelSelector bind:selectedModels showSetDefault={!shareEnabled && !readOnly} disabled={readOnly} />
|
<ModelSelector
|
||||||
|
bind:selectedModels
|
||||||
|
showSetDefault={!shareEnabled && !readOnly}
|
||||||
|
disabled={readOnly}
|
||||||
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,6 @@
|
|||||||
let orderBy = 'updated_at';
|
let orderBy = 'updated_at';
|
||||||
let direction = 'desc'; // 'asc' or 'desc'
|
let direction = 'desc'; // 'asc' or 'desc'
|
||||||
|
|
||||||
|
|
||||||
$: if (chats) {
|
$: if (chats) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,18 +38,18 @@
|
|||||||
if (folder && folder.id) {
|
if (folder && folder.id) {
|
||||||
// Always use the shared folder endpoint so owners also see
|
// Always use the shared folder endpoint so owners also see
|
||||||
// chats created by users who have write access to this folder.
|
// chats created by users who have write access to this folder.
|
||||||
const res = await getSharedFolderChats(localStorage.token, folder.id).catch(
|
const res = await getSharedFolderChats(localStorage.token, folder.id).catch((error) => {
|
||||||
(error) => {
|
console.error(error);
|
||||||
console.error(error);
|
return null;
|
||||||
return null;
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res && res.chats) {
|
if (res && res.chats) {
|
||||||
chats = res.chats;
|
chats = res.chats;
|
||||||
allChatsLoaded = true;
|
allChatsLoaded = true;
|
||||||
} else {
|
} else {
|
||||||
// Fallback to regular API (e.g. if user has no shared access)
|
// Fallback to regular API (e.g. if user has no shared access)
|
||||||
const fallback = await getChatListByFolderId(localStorage.token, folder.id, page).catch(() => []);
|
const fallback = await getChatListByFolderId(localStorage.token, folder.id, page).catch(
|
||||||
|
() => []
|
||||||
|
);
|
||||||
chats = fallback || [];
|
chats = fallback || [];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user