Skip to content
Open
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
30 changes: 30 additions & 0 deletions apps/web/src/components/ChatView.logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { afterEach, describe, expect, it, vi } from "vitest";
import { useStore } from "../store";

import {
buildDefaultComposerPlaceholder,
buildDisconnectedComposerPlaceholder,
buildExpiredTerminalContextToastCopy,
createLocalDispatchSnapshot,
deriveComposerSendState,
Expand Down Expand Up @@ -75,6 +77,34 @@ describe("buildExpiredTerminalContextToastCopy", () => {
});
});

describe("buildDefaultComposerPlaceholder", () => {
it("mentions skills for Codex threads", () => {
expect(buildDefaultComposerPlaceholder("codex")).toBe(
"Ask anything, @tag files/folders, type $ to mention skills, or use / to show available commands",
);
});

it("keeps non-Codex placeholders focused on supported composer commands", () => {
expect(buildDefaultComposerPlaceholder("claudeAgent")).toBe(
"Ask anything, @tag files/folders, or use / to show available commands",
);
});
});

describe("buildDisconnectedComposerPlaceholder", () => {
it("mentions skills for disconnected Codex threads", () => {
expect(buildDisconnectedComposerPlaceholder("codex")).toBe(
"Ask for follow-up changes, type $ to mention skills, or attach images",
);
});

it("keeps disconnected non-Codex placeholders unchanged", () => {
expect(buildDisconnectedComposerPlaceholder("claudeAgent")).toBe(
"Ask for follow-up changes or attach images",
);
});
});

const makeThread = (input?: {
id?: ThreadId;
latestTurn?: {
Expand Down
22 changes: 21 additions & 1 deletion apps/web/src/components/ChatView.logic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { ProjectId, type ModelSelection, type ThreadId, type TurnId } from "@t3tools/contracts";
import {
ProjectId,
type ModelSelection,
type ProviderKind,
type ThreadId,
type TurnId,
} from "@t3tools/contracts";
import { type ChatMessage, type SessionPhase, type Thread, type ThreadSession } from "../types";
import { randomUUID } from "~/lib/utils";
import { type ComposerImageAttachment, type DraftThreadState } from "../composerDraftStore";
Expand Down Expand Up @@ -160,6 +166,20 @@ export function buildExpiredTerminalContextToastCopy(
};
}

export function buildDefaultComposerPlaceholder(provider: ProviderKind): string {
if (provider === "codex") {
return "Ask anything, @tag files/folders, type $ to mention skills, or use / to show available commands";
}
return "Ask anything, @tag files/folders, or use / to show available commands";
}

export function buildDisconnectedComposerPlaceholder(provider: ProviderKind): string {
if (provider === "codex") {
return "Ask for follow-up changes, type $ to mention skills, or attach images";
}
return "Ask for follow-up changes or attach images";
}

export function threadHasStarted(thread: Thread | null | undefined): boolean {
return Boolean(
thread && (thread.latestTurn !== null || thread.messages.length > 0 || thread.session !== null),
Expand Down
6 changes: 4 additions & 2 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ import {
import { ProviderStatusBanner } from "./chat/ProviderStatusBanner";
import { ThreadErrorBanner } from "./chat/ThreadErrorBanner";
import {
buildDefaultComposerPlaceholder,
buildDisconnectedComposerPlaceholder,
buildExpiredTerminalContextToastCopy,
buildLocalDraftThread,
buildTemporaryWorktreeBranchName,
Expand Down Expand Up @@ -3951,8 +3953,8 @@ export default function ChatView({ threadId }: ChatViewProps) {
: showPlanFollowUpPrompt && activeProposedPlan
? "Add feedback to refine the plan, or leave this blank to implement it"
: phase === "disconnected"
? "Ask for follow-up changes or attach images"
: "Ask anything, @tag files/folders, or use / to show available commands"
? buildDisconnectedComposerPlaceholder(selectedProvider)
: buildDefaultComposerPlaceholder(selectedProvider)
}
disabled={isConnecting || isComposerApprovalState}
/>
Expand Down
Loading