balibabu
commited on
Commit
·
eba9f1d
1
Parent(s):
59ca130
fix: Add model by ollama in model provider page, user can't choose the model in chat window. #2479 (#2529)
Browse files### What problem does this PR solve?
fix: Add model by ollama in model provider page, user can't choose the
model in chat window. #2479
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
web/src/components/llm-select/index.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
import { Popover, Select } from 'antd';
|
| 2 |
import LlmSettingItems from '../llm-setting-items';
|
| 3 |
|
|
@@ -8,6 +10,8 @@ interface IProps {
|
|
| 8 |
}
|
| 9 |
|
| 10 |
const LLMSelect = ({ id, value, onChange }: IProps) => {
|
|
|
|
|
|
|
| 11 |
const content = (
|
| 12 |
<div style={{ width: 400 }}>
|
| 13 |
<LlmSettingItems
|
|
@@ -25,6 +29,10 @@ const LLMSelect = ({ id, value, onChange }: IProps) => {
|
|
| 25 |
destroyTooltipOnHide
|
| 26 |
>
|
| 27 |
<Select
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
style={{ width: '100%' }}
|
| 29 |
dropdownStyle={{ display: 'none' }}
|
| 30 |
id={id}
|
|
|
|
| 1 |
+
import { LlmModelType } from '@/constants/knowledge';
|
| 2 |
+
import { useSelectLlmOptionsByModelType } from '@/hooks/llm-hooks';
|
| 3 |
import { Popover, Select } from 'antd';
|
| 4 |
import LlmSettingItems from '../llm-setting-items';
|
| 5 |
|
|
|
|
| 10 |
}
|
| 11 |
|
| 12 |
const LLMSelect = ({ id, value, onChange }: IProps) => {
|
| 13 |
+
const modelOptions = useSelectLlmOptionsByModelType();
|
| 14 |
+
|
| 15 |
const content = (
|
| 16 |
<div style={{ width: 400 }}>
|
| 17 |
<LlmSettingItems
|
|
|
|
| 29 |
destroyTooltipOnHide
|
| 30 |
>
|
| 31 |
<Select
|
| 32 |
+
options={[
|
| 33 |
+
...modelOptions[LlmModelType.Chat],
|
| 34 |
+
...modelOptions[LlmModelType.Image2text],
|
| 35 |
+
]}
|
| 36 |
style={{ width: '100%' }}
|
| 37 |
dropdownStyle={{ display: 'none' }}
|
| 38 |
id={id}
|
web/src/hooks/llm-hooks.ts
CHANGED
|
@@ -71,7 +71,7 @@ export const useSelectLlmOptionsByModelType = () => {
|
|
| 71 |
)
|
| 72 |
.map((x) => ({
|
| 73 |
label: x.llm_name,
|
| 74 |
-
value: x.llm_name
|
| 75 |
disabled: !x.available,
|
| 76 |
})),
|
| 77 |
};
|
|
|
|
| 71 |
)
|
| 72 |
.map((x) => ({
|
| 73 |
label: x.llm_name,
|
| 74 |
+
value: `${x.llm_name}@${x.fid}`,
|
| 75 |
disabled: !x.available,
|
| 76 |
})),
|
| 77 |
};
|