Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Fix compare adapter selection (#6411)
Lee Jackson2f8521ed54b2
diff --git a/studio/frontend/src/features/chat/api/chat-adapter.ts b/studio/frontend/src/features/chat/api/chat-adapter.tsindex 01069808713..ca7ac174fc2 100644--- a/studio/frontend/src/features/chat/api/chat-adapter.ts+++ b/studio/frontend/src/features/chat/api/chat-adapter.ts@@ -47,6 +47,7 @@ import {useChatRuntimeStore,} from "../stores/chat-runtime-store";import { useExternalProvidersStore } from "../stores/external-providers-store";+import type { ModelType } from "../types";import { isMultimodalResponse } from "../types/api";import type {GgufVariantDetail,@@ -142,6 +143,11 @@ interface ServerTimings {type RunMessages = Parameters<ChatModelAdapter["run"]>[0]["messages"];type RunMessage = RunMessages[number];+type OpenAIStreamAdapterOptions = {+ modelType?: ModelType;+ pairId?: string;+};+/** Tracks which user messages were sent with an audio file (messageId → filename). */export const sentAudioNames = new Map<string, string>();@@ -1182,7 +1188,17 @@ export function findLatestUserAudioBase64(async function resolveUseAdapter(threadId: string | undefined,+ options: OpenAIStreamAdapterOptions = {},): Promise<boolean | undefined> {+ if (options.modelType === "model1" || options.modelType === "model2") {+ return undefined;+ }+ if (+ options.pairId &&+ (options.modelType === "base" || options.modelType === "lora")+ ) {+ return options.modelType === "lora";+ }if (!threadId) {return undefined;}@@ -1629,7 +1645,9 @@ async function autoLoadSmallestModel(): Promise<{}}-export function createOpenAIStreamAdapter(): ChatModelAdapter {+export function createOpenAIStreamAdapter(+ options: OpenAIStreamAdapterOptions = {},+): ChatModelAdapter {return {async *run({ messages, abortSignal, unstable_threadId }) {await useChatRuntimeStore.getState().hydratePersistedSettings();@@ -2076,7 +2094,7 @@ export function createOpenAIStreamAdapter(): ChatModelAdapter {}runtime.clearPendingAudio();}- const useAdapter = await resolveUseAdapter(resolvedThreadId);+ const useAdapter = await resolveUseAdapter(resolvedThreadId, options);// ── Audio model path (non-streaming) ─────────────────────const activeModel = runtime.models.find(diff --git a/studio/frontend/src/features/chat/runtime-provider.tsx b/studio/frontend/src/features/chat/runtime-provider.tsxindex 360e081f0f0..67980b94c65 100644--- a/studio/frontend/src/features/chat/runtime-provider.tsx+++ b/studio/frontend/src/features/chat/runtime-provider.tsx@@ -1045,16 +1045,17 @@ function useStudioRuntimeAdapters(return adapters;}-const chatAdapter = createOpenAIStreamAdapter();-function useRuntimeHook(modelType: ModelType,pairId?: string,): ReturnType<typeof useLocalRuntime> {const adapters = useStudioRuntimeAdapters(modelType, pairId);const persistedChatAdapter = useMemo(- () => createPersistedRunAdapter(chatAdapter),- [],+ () =>+ createPersistedRunAdapter(+ createOpenAIStreamAdapter({ modelType, pairId }),+ ),+ [modelType, pairId],);return useLocalRuntime(persistedChatAdapter, { adapters });}