Skip to content

Commit

Permalink
tweak context preset
Browse files Browse the repository at this point in the history
  • Loading branch information
sceuick committed Sep 8, 2024
1 parent 01d3c0c commit bf8b594
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion web/pages/Chat/ChatHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ const ChatNav: Component<NavProps> = (props) => {
() => props.ctx.chat?.userId === props.ctx.user?._id && props.ctx.chat?.mode !== 'companion'
)

const canModel = createMemo(() => props.ctx.info?.adapter === 'agnaistic')

const size = 20

return (
Expand Down Expand Up @@ -126,7 +128,7 @@ const ChatNav: Component<NavProps> = (props) => {
</Nav.Item>
</Show>

<Show when={props.ctx.info?.adapter === 'agnaistic'}>
<Show when={canModel()}>
<div class="flex w-full justify-center">
<AgnaisticModel inherit={props.ctx.preset} />
</div>
Expand Down
5 changes: 3 additions & 2 deletions web/store/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getRgbaFromVar } from '../shared/colors'
import { MsgState, msgStore } from './message'
import { ChatTree } from '/common/chat'
import { presetStore } from './presets'
import { getChatPreset } from '/common/prompt'

export type ContextState = {
tooltip?: string | JSX.Element
Expand Down Expand Up @@ -139,8 +140,8 @@ export function ContextProvider(props: { children: any }) {
})

const preset = createMemo(() => {
const id = chats.active?.chat.genPreset || users.user?.defaultPreset
const match = presets.presets.find((p) => p._id === id)
if (!chats.active?.chat || !users.user) return
const match = getChatPreset(chats.active.chat, users.user, presets.presets)
return match
})

Expand Down

0 comments on commit bf8b594

Please sign in to comment.