lint
This commit is contained in:
parent
9165480dfb
commit
781d003849
|
@ -1,9 +1,9 @@
|
|||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { getProfile } from "./lib/Profiles.svelte"
|
||||
import { setChatSettingValue } from "./lib/Storage.svelte"
|
||||
import type { Chat, ChatSetting, ChatSettings } from "./lib/Types.svelte"
|
||||
import { autoGrowInputOnEvent } from "./lib/Util.svelte"
|
||||
import { getProfile } from './lib/Profiles.svelte'
|
||||
import { setChatSettingValue } from './lib/Storage.svelte'
|
||||
import type { Chat, ChatSetting, ChatSettings } from './lib/Types.svelte'
|
||||
import { autoGrowInputOnEvent } from './lib/Util.svelte'
|
||||
|
||||
export let setting:ChatSetting
|
||||
export let chatSettings:ChatSettings
|
||||
|
|
|
@ -179,7 +179,8 @@
|
|||
const mlen = filtered.length - systemPad // always keep system prompt
|
||||
let diff = mlen - (pinTop + pinBottom)
|
||||
const useRollMode = !prepareSummaryPrompt(chatId, 0)
|
||||
while (!useRollMode && diff <= 3 && (pinTop > 0 || pinBottom > 1)) {
|
||||
if (!useRollMode) {
|
||||
while (diff <= 3 && (pinTop > 0 || pinBottom > 1)) {
|
||||
// Not enough prompts exposed to summarize
|
||||
// try to open up pinTop and pinBottom to see if we can get more to summarize
|
||||
if (pinTop === 1 && pinBottom > 1) {
|
||||
|
@ -191,6 +192,7 @@
|
|||
}
|
||||
diff = mlen - (pinTop + pinBottom)
|
||||
}
|
||||
}
|
||||
if (!useRollMode && diff > 0) {
|
||||
// We've found at least one prompt we can try to summarize
|
||||
// Reduce to prompts we'll send in for summary
|
||||
|
@ -287,12 +289,12 @@
|
|||
addMessage(chatId, { role: 'error', content: 'Unable to summarize. Not enough messages in past content to summarize.', uuid: uuidv4() })
|
||||
} else {
|
||||
// roll-off mode
|
||||
const top = filtered.slice(0,pinTop+systemPad)
|
||||
let rollaway = filtered.slice(pinTop+systemPad)
|
||||
const top = filtered.slice(0, pinTop + systemPad)
|
||||
const rollaway = filtered.slice(pinTop + systemPad)
|
||||
let promptTokenCount = countPromptTokens(top.concat(rollaway), model)
|
||||
// suppress messages we're rolling off
|
||||
while (rollaway.length > (((promptTokenCount + (chatSettings.max_tokens||1)) > maxTokens) ? pinBottom||1 : 1)
|
||||
&& promptTokenCount >= chatSettings.summaryThreshold) {
|
||||
while (rollaway.length > (((promptTokenCount + (chatSettings.max_tokens || 1)) > maxTokens) ? pinBottom || 1 : 1) &&
|
||||
promptTokenCount >= chatSettings.summaryThreshold) {
|
||||
const rollOff = rollaway.shift()
|
||||
if (rollOff) rollOff.suppress = true
|
||||
promptTokenCount = countPromptTokens(top.concat(rollaway), model)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import { applyProfile, getDefaultProfileKey, getProfile, getProfileSelect } from './Profiles.svelte'
|
||||
import { applyProfile, getDefaultProfileKey, getProfileSelect } from './Profiles.svelte'
|
||||
import { getChatDefaults, getChatSettingList, getChatSettingObjectByKey } from './Settings.svelte'
|
||||
import {
|
||||
saveChatStore,
|
||||
|
@ -10,11 +10,10 @@
|
|||
deleteCustomProfile,
|
||||
setGlobalSettingValueByKey,
|
||||
resetChatSettings,
|
||||
setChatSettingValue,
|
||||
checkStateChange
|
||||
} from './Storage.svelte'
|
||||
import { supportedModels, type Chat, type ChatSetting, type ResponseModels, type SettingSelect, type SelectOption } from './Types.svelte'
|
||||
import { sizeTextElements, autoGrowInputOnEvent } from './Util.svelte'
|
||||
import { sizeTextElements } from './Util.svelte'
|
||||
import Fa from 'svelte-fa/src/fa.svelte'
|
||||
import {
|
||||
faTrash,
|
||||
|
@ -27,7 +26,7 @@
|
|||
} from '@fortawesome/free-solid-svg-icons/index'
|
||||
import { exportProfileAsJSON } from './Export.svelte'
|
||||
import { afterUpdate } from 'svelte'
|
||||
import ChatSettingField from '../ChatSettingField.svelte';
|
||||
import ChatSettingField from '../ChatSettingField.svelte'
|
||||
|
||||
export let chatId:number
|
||||
export const show = () => { showSettings() }
|
||||
|
|
|
@ -156,8 +156,7 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
let waitingForSuppressConfirm:any = 0
|
||||
const waitingForSuppressConfirm:any = 0
|
||||
|
||||
const setSuppress = (value:boolean) => {
|
||||
// clearTimeout(waitingForSuppressConfirm); waitingForSuppressConfirm = 0
|
||||
|
|
|
@ -103,7 +103,7 @@ const profileSetting: ChatSetting & SettingSelect = {
|
|||
},
|
||||
setDefault: (chatId, setting, value) => {
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Settings that will not be part of the API request
|
||||
|
|
Loading…
Reference in New Issue