= {
- book: BookOpen,
- database: Database,
- error: CircleAlert,
- flask: FlaskConical,
- list: ListTodo,
- logs: Logs,
- package: Package,
- search: Search,
- settings: Settings,
- variable: Variable,
-};
-
-interface ExampleQuestionBadgesProps {
- questions: readonly ExampleQuestion[];
- disabled?: boolean;
-}
-
-export function ExampleQuestionBadges({
- questions,
- disabled = false,
-}: ExampleQuestionBadgesProps) {
- const editor = useSlate();
-
- const insertQuestion = (question: string) => {
- Transforms.select(editor, Editor.range(editor, []));
- Transforms.insertText(editor, question);
- ReactEditor.focus(editor);
- };
-
- return (
-
-
- Ask questions about:
-
- {questions.map(({ label, question, icon }) => {
- const Icon = icons[icon];
- return (
-
- );
- })}
-
- );
-}
diff --git a/packages/web/src/app/(app)/chat/components/exampleQuestions.test.ts b/packages/web/src/app/(app)/chat/components/exampleQuestions.test.ts
deleted file mode 100644
index 9ce7a03d8..000000000
--- a/packages/web/src/app/(app)/chat/components/exampleQuestions.test.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { describe, expect, test } from "vitest";
-import {
- exampleQuestions,
- selectRandomExampleQuestions,
-} from "./exampleQuestions";
-
-describe("selectRandomExampleQuestions", () => {
- test("selects three unique questions from the larger pool", () => {
- const selectedQuestions = selectRandomExampleQuestions(3, () => 0);
-
- expect(exampleQuestions.length).toBeGreaterThan(3);
- expect(selectedQuestions).toHaveLength(3);
- expect(new Set(selectedQuestions.map(({ label }) => label)).size).toBe(3);
- expect(selectedQuestions.every((question) =>
- exampleQuestions.some(({ label }) => label === question.label)
- )).toBe(true);
- });
-});
diff --git a/packages/web/src/app/(app)/chat/components/exampleQuestions.ts b/packages/web/src/app/(app)/chat/components/exampleQuestions.ts
deleted file mode 100644
index 3cd4a17ad..000000000
--- a/packages/web/src/app/(app)/chat/components/exampleQuestions.ts
+++ /dev/null
@@ -1,86 +0,0 @@
-export type ExampleQuestionIcon =
- | "book"
- | "database"
- | "error"
- | "flask"
- | "list"
- | "logs"
- | "package"
- | "search"
- | "settings"
- | "variable";
-
-export interface ExampleQuestion {
- label: string;
- question: string;
- icon: ExampleQuestionIcon;
-}
-
-export const exampleQuestions = [
- {
- label: "Entry points",
- question: "Find the main entry points across all repositories.",
- icon: "search",
- },
- {
- label: "Configuration",
- question: "Where is configuration defined and loaded?",
- icon: "settings",
- },
- {
- label: "Testing",
- question: "Find examples of how this code is tested.",
- icon: "flask",
- },
- {
- label: "Error handling",
- question: "Find common error-handling patterns across the codebase.",
- icon: "error",
- },
- {
- label: "Data models",
- question: "Where are the main data models defined?",
- icon: "database",
- },
- {
- label: "TODOs",
- question: "Find TODOs and summarize the unfinished work.",
- icon: "list",
- },
- {
- label: "Dependencies",
- question: "Where are project dependencies declared and configured?",
- icon: "package",
- },
- {
- label: "Environment",
- question: "Where are environment variables read and used?",
- icon: "variable",
- },
- {
- label: "Logging",
- question: "Where and how is logging used?",
- icon: "logs",
- },
- {
- label: "Documentation",
- question: "Find the most useful developer documentation.",
- icon: "book",
- },
-] as const satisfies readonly ExampleQuestion[];
-
-export const selectRandomExampleQuestions = (
- count: number,
- random: () => number = Math.random,
-): ExampleQuestion[] => {
- const shuffled: ExampleQuestion[] = [...exampleQuestions];
- for (let index = shuffled.length - 1; index > 0; index -= 1) {
- const swapIndex = Math.floor(random() * (index + 1));
- [shuffled[index], shuffled[swapIndex]] = [
- shuffled[swapIndex]!,
- shuffled[index]!,
- ];
- }
-
- return shuffled.slice(0, Math.max(0, count));
-};