Skip to content

Commit

Permalink
Show model length as part of host input
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdjohnson committed Jul 13, 2024
1 parent 252196b commit 65a8eb9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/HostInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ type HostInputProps = {
const HostInput = observer(({ connection, isEnabled }: HostInputProps) => {
const { host } = connection

const { control } = useFormContext<SnapshotIn<IConnectionDataModel>>()
const {
control,
formState: { dirtyFields },
} = useFormContext<SnapshotIn<IConnectionDataModel>>()

const isDirty = dirtyFields.host

const modelsFoundLabel = isDirty
? 'Save to see model length'
: `${connection.models.length} models found`

return (
<Controller
Expand All @@ -39,6 +48,7 @@ const HostInput = observer(({ connection, isEnabled }: HostInputProps) => {
>
<Question />
</button>
<span className="ml-auto pl-2">{modelsFoundLabel}</span>
</span>
}
endContent={
Expand All @@ -48,6 +58,7 @@ const HostInput = observer(({ connection, isEnabled }: HostInputProps) => {
type="button"
title="Refresh models"
onClick={() => connection.fetchLmModels()}
disabled={isDirty}
>
<Refresh />
</button>
Expand Down

0 comments on commit 65a8eb9

Please sign in to comment.