From 54a91e6b7ce05c7abcc9f13f0cd5a1d45edb2268 Mon Sep 17 00:00:00 2001 From: Sceik <60520115+sceuick@users.noreply.github.com> Date: Sun, 10 Nov 2024 15:19:43 +0800 Subject: [PATCH] Fix xtc probability slider (#1071) * Fix xtc probability slider * convert model list cta to button - re-add respond as me - clamp agnai temp to 10 --- srv/adapter/payloads.ts | 2 +- srv/api/chat/message.ts | 3 ++- web/pages/Chat/ChatDetail.tsx | 2 +- web/pages/Chat/components/InputBar.tsx | 25 ++++++++++++++++++++----- web/pages/Profile/TierCard.tsx | 7 ++++++- web/shared/PresetSettings/Sliders.tsx | 2 +- web/shared/PresetSettings/types.ts | 1 - web/store/data/bot-generate.ts | 4 +++- 8 files changed, 34 insertions(+), 12 deletions(-) diff --git a/srv/adapter/payloads.ts b/srv/adapter/payloads.ts index 987babbdf..89b37980e 100644 --- a/srv/adapter/payloads.ts +++ b/srv/adapter/payloads.ts @@ -64,7 +64,7 @@ function getBasePayload(opts: AdapterProps, stops: string[] = []) { context_limit: gen.maxContextLength, max_new_tokens: gen.maxTokens, do_sample: gen.doSample ?? true, - temperature: gen.temp, + temperature: Math.min(gen.temp, 10), top_p: gen.topP, typical_p: gen.typicalP || 1, repetition_penalty: gen.repetitionPenalty, diff --git a/srv/api/chat/message.ts b/srv/api/chat/message.ts index b37416b37..f147c789a 100644 --- a/srv/api/chat/message.ts +++ b/srv/api/chat/message.ts @@ -670,7 +670,8 @@ async function handleGuestGenerate(body: GenRequest, req: AppRequest, res: Respo responseText = hydration.response } - const characterId = body.kind === 'self' ? undefined : body.replyAs?._id || body.char?._id + const characterId = + body.kind === 'self' ? body.impersonate?._id : body.replyAs?._id || body.char?._id const senderId = body.kind === 'self' ? 'anon' : undefined const parent = getNewMessageParent(body, newMsg) diff --git a/web/pages/Chat/ChatDetail.tsx b/web/pages/Chat/ChatDetail.tsx index fbf539951..48b96d270 100644 --- a/web/pages/Chat/ChatDetail.tsx +++ b/web/pages/Chat/ChatDetail.tsx @@ -214,7 +214,7 @@ const ChatDetail: Component = () => { waitingMsgs.push( emptyMsg({ id: 'partial-response', - charId: msgs.waiting?.mode !== 'self' ? msgs.waiting.characterId : undefined, + charId: msgs.waiting?.mode !== 'self' ? msgs.waiting.characterId : ctx.impersonate?._id, userId: msgs.waiting?.mode === 'self' ? msgs.waiting.userId || user.user?._id : undefined, message: msgs.partial || '', adapter: 'partial-response', diff --git a/web/pages/Chat/components/InputBar.tsx b/web/pages/Chat/components/InputBar.tsx index 743907f46..6115c0887 100644 --- a/web/pages/Chat/components/InputBar.tsx +++ b/web/pages/Chat/components/InputBar.tsx @@ -1,4 +1,13 @@ -import { ImagePlus, ImageUp, Megaphone, MoreHorizontal, PlusCircle, Send, Zap } from 'lucide-solid' +import { + ImagePlus, + ImageUp, + Megaphone, + MessageCircle, + MoreHorizontal, + PlusCircle, + Send, + Zap, +} from 'lucide-solid' import { Component, createMemo, @@ -322,10 +331,16 @@ const InputBar: Component<{ setMenu(false)} vert="up" horz="left">
- {/* */} + 1}>
Auto-reply
} + cta={ +
+ +
+ } >
= (props) => { min={0} max={1} step={0.01} - value={props.state.dynatemp_range ?? 0} + value={props.state.xtcProbability ?? 0} disabled={props.state.disabled} aiSetting={'xtcProbability'} recommended={0.5} diff --git a/web/shared/PresetSettings/types.ts b/web/shared/PresetSettings/types.ts index 13c073cb2..b96664dce 100644 --- a/web/shared/PresetSettings/types.ts +++ b/web/shared/PresetSettings/types.ts @@ -106,7 +106,6 @@ function hidePresetSetting( if (!prop) { hide = false } else if (!isValidServiceSetting(state, prop)) { - console.log('eval:invalid', prop) hide = true } else if (state.presetMode && state.presetMode !== 'advanced') { const enabled = MODE_SETTINGS[state.presetMode]?.[prop] diff --git a/web/store/data/bot-generate.ts b/web/store/data/bot-generate.ts index 20043267c..42bef1e55 100644 --- a/web/store/data/bot-generate.ts +++ b/web/store/data/bot-generate.ts @@ -111,7 +111,9 @@ export async function generateResponse( settings: entities.settings, replacing: props.replacing, continuing: props.continuing, - replyAs: removeAvatar(props.replyAs), + replyAs: removeAvatar( + opts.kind === 'self' && props.impersonate ? props.impersonate : props.replyAs + ), impersonate: removeAvatar(props.impersonate), characters: removeAvatars(entities.characters), parent: props.parent?._id,