Refactor: Replace all provider split occurrences with getModelProvider utility method

This commit is contained in:
ryanhex53
2024-11-05 13:52:54 +00:00
parent b844045d23
commit 8e2484fcdf
6 changed files with 60 additions and 13 deletions

View File

@@ -120,6 +120,7 @@ import { createTTSPlayer } from "../utils/audio";
import { MsEdgeTTS, OUTPUT_FORMAT } from "../utils/ms_edge_tts";
import { isEmpty } from "lodash-es";
import { getModelProvider } from "../utils/model";
const localStorage = safeLocalStorage();
@@ -645,7 +646,7 @@ export function ChatActions(props: {
onClose={() => setShowModelSelector(false)}
onSelection={(s) => {
if (s.length === 0) return;
const [model, providerName] = s[0].split(/@(?!.*@)/);
const [model, providerName] = getModelProvider(s[0]);
chatStore.updateCurrentSession((session) => {
session.mask.modelConfig.model = model as ModelType;
session.mask.modelConfig.providerName =