Skip to content

Commit

Permalink
Fix xtc probability slider (#1071)
Browse files Browse the repository at this point in the history
* Fix xtc probability slider
* convert model list cta to button
- re-add respond as me
- clamp agnai temp to 10
  • Loading branch information
sceuick authored Nov 10, 2024
1 parent 5e8466c commit 54a91e6
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion srv/adapter/payloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion srv/api/chat/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion web/pages/Chat/ChatDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
25 changes: 20 additions & 5 deletions web/pages/Chat/components/InputBar.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -322,10 +331,16 @@ const InputBar: Component<{

<DropMenu show={menu()} close={() => setMenu(false)} vert="up" horz="left">
<div class="flex w-48 flex-col gap-2 p-2">
{/* <Button schema="secondary" class="w-full" onClick={generateSelf} alignLeft>
<MessageCircle size={18} />
Respond as Me
</Button> */}
<Button
schema="secondary"
class="w-full"
onClick={() => msgStore.selfGenerate()}
alignLeft
disabled={!ctx.impersonate}
>
<MessageCircle size={18} />
Respond as Me
</Button>
<Show when={ctx.activeBots.length > 1}>
<div>Auto-reply</div>
<Button
Expand Down
7 changes: 6 additions & 1 deletion web/pages/Profile/TierCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { markdown } from '/web/shared/markdown'
import { settingStore } from '/web/store'
import { HelpModal } from '/web/shared/Modal'
import { getSubscriptionModelLimits } from '/common/util'
import Button from '/web/shared/Button'

type TierPreview = OmitId<AppSchema.SubscriptionTier, Dates | 'enabled' | 'priceId' | 'productId'>

Expand Down Expand Up @@ -76,7 +77,11 @@ export const TierCard: Component<{
<Show when={models().length > 0}>
<HelpModal
title={`Models on ${props.tier.name}`}
cta={<div class="link flex justify-center text-sm">Models</div>}
cta={
<div class="flex justify-center">
<Button size="sm">View Models</Button>
</div>
}
>
<div
class="markdown text-sm"
Expand Down
2 changes: 1 addition & 1 deletion web/shared/PresetSettings/Sliders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const SliderSettings: Component<PresetTabProps> = (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}
Expand Down
1 change: 0 additions & 1 deletion web/shared/PresetSettings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 3 additions & 1 deletion web/store/data/bot-generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 54a91e6

Please sign in to comment.