refac
This commit is contained in:
@@ -89,7 +89,7 @@
|
||||
let message = history.messages[history.currentId];
|
||||
const visitedMessageIds = new Set();
|
||||
|
||||
while (message && (messagesCount !== null ? _messages.length <= messagesCount : true)) {
|
||||
while (message && (messagesCount !== null ? _messages.length < messagesCount : true)) {
|
||||
if (visitedMessageIds.has(message.id)) {
|
||||
console.warn('Circular dependency detected in message history', message.id);
|
||||
break;
|
||||
|
||||
@@ -1074,37 +1074,6 @@
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
{#if message.done && !readOnly && forkHandler}
|
||||
<Tooltip content="Fork chat" placement="bottom">
|
||||
<button
|
||||
aria-label="Fork chat"
|
||||
class="{isLastMessage || ($settings?.highContrastMode ?? false)
|
||||
? 'visible'
|
||||
: 'invisible group-hover:visible'} p-1.5 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg dark:hover:text-white hover:text-black transition"
|
||||
on:click={() => {
|
||||
forkHandler?.(message.id);
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
class="w-4 h-4"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.8"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M4 12H9" />
|
||||
<path d="M9 12C12.5 12 12.5 7 16 7H20" />
|
||||
<path d="M17 4L20 7L17 10" />
|
||||
<path d="M9 12C12.5 12 12.5 17 16 17H20" />
|
||||
<path d="M17 14L20 17L17 20" />
|
||||
</svg>
|
||||
</button>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
||||
{#if onInsertToNote && visibleResponseContent}
|
||||
<Tooltip content={$i18n.t('Insert into note')} placement="bottom">
|
||||
<button
|
||||
@@ -1369,6 +1338,37 @@
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
||||
{#if message.done && !readOnly && forkHandler}
|
||||
<Tooltip content="Fork chat" placement="bottom">
|
||||
<button
|
||||
aria-label="Fork chat"
|
||||
class="{isLastMessage || ($settings?.highContrastMode ?? false)
|
||||
? 'visible'
|
||||
: 'invisible group-hover:visible'} p-1.5 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg dark:hover:text-white hover:text-black transition"
|
||||
on:click={() => {
|
||||
forkHandler?.(message.id);
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
class="w-4 h-4"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.8"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M4 12H9" />
|
||||
<path d="M9 12C12.5 12 12.5 7 16 7H20" />
|
||||
<path d="M17 4L20 7L17 10" />
|
||||
<path d="M9 12C12.5 12 12.5 17 16 17H20" />
|
||||
<path d="M17 14L20 17L17 20" />
|
||||
</svg>
|
||||
</button>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
||||
{#if $user?.role === 'admin' || ($user?.permissions?.chat?.regenerate_response ?? true)}
|
||||
{#if $settings?.regenerateMenu ?? true}
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user