fix: #2303 should select custom models

This commit is contained in:
Yidadaa
2023-07-09 21:56:49 +08:00
parent 8e4743e719
commit 09b05cde7f
3 changed files with 18 additions and 15 deletions

View File

@@ -414,8 +414,12 @@ export function ChatActions(props: {
// switch model
const currentModel = chatStore.currentSession().mask.modelConfig.model;
const models = useMemo(
() => config.models.filter((m) => m.available).map((m) => m.name),
[config.models],
() =>
config
.allModels()
.filter((m) => m.available)
.map((m) => m.name),
[config],
);
const [showModelSelector, setShowModelSelector] = useState(false);

View File

@@ -9,10 +9,6 @@ export function ModelConfigList(props: {
updateConfig: (updater: (config: ModelConfig) => void) => void;
}) {
const config = useAppConfig();
const customModels = config.customModels
.split(",")
.map((m) => ({ name: m, available: true }));
const models = config.models.concat(customModels);
return (
<>
@@ -28,7 +24,7 @@ export function ModelConfigList(props: {
);
}}
>
{models.map((v, i) => (
{config.allModels().map((v, i) => (
<option value={v.name} key={i} disabled={!v.available}>
{v.name}
</option>