Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/web/src/components/BranchToolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { scopeProjectRef, scopeThreadRef } from "@t3tools/client-runtime";
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
import { useMemo } from "react";
import { memo, useMemo } from "react";

import { useComposerDraftStore, type DraftId } from "../composerDraftStore";
import { useStore } from "../store";
Expand All @@ -27,7 +27,7 @@ interface BranchToolbarProps {
onEnvironmentChange?: (environmentId: EnvironmentId) => void;
}

export function BranchToolbar({
export const BranchToolbar = memo(function BranchToolbar({
environmentId,
threadId,
draftId,
Expand Down Expand Up @@ -101,4 +101,4 @@ export function BranchToolbar({
/>
</div>
);
}
});
12 changes: 12 additions & 0 deletions apps/web/src/components/ChatView.logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
type EnvironmentId,
ProjectId,
type ModelSelection,
type ProviderKind,
type ScopedThreadRef,
type ThreadId,
type TurnId,
Expand Down Expand Up @@ -225,6 +226,17 @@ export function threadHasStarted(thread: Thread | null | undefined): boolean {
);
}

export function deriveLockedProvider(input: {
thread: Thread | null | undefined;
selectedProvider: ProviderKind | null;
threadProvider: ProviderKind | null;
}): ProviderKind | null {
if (!threadHasStarted(input.thread)) {
return null;
}
return input.thread?.session?.provider ?? input.threadProvider ?? input.selectedProvider ?? null;
}

export async function waitForStartedServerThread(
threadRef: ScopedThreadRef,
timeoutMs = 1_000,
Expand Down
Loading
Loading