mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-03 15:01:00 +02:00
Squashed 'ai-context/workbench-ui/' content from commit 32e36a5c
git-subtree-dir: ai-context/workbench-ui git-subtree-split: 32e36a5c2131e429a7081cfaf67dabad3193cda3
This commit is contained in:
commit
a8390532f7
310 changed files with 56430 additions and 0 deletions
49
src/model/prompts-table.tsx
Normal file
49
src/model/prompts-table.tsx
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import { createColumnHelper } from "@tanstack/react-table";
|
||||
import { Code } from "@chakra-ui/react";
|
||||
|
||||
/**
|
||||
* Prompt data structure for the prompts table
|
||||
* Represents a prompt template with its metadata and configuration
|
||||
*/
|
||||
export type Prompt = {
|
||||
id: string; // Unique identifier for the prompt template
|
||||
prompt: string; // The prompt text content
|
||||
responseType: "json" | "text"; // Type of response expected
|
||||
hasSchema: boolean; // Whether the prompt has a schema defined
|
||||
};
|
||||
|
||||
// Create a column helper instance for type-safe column definitions
|
||||
export const columnHelper = createColumnHelper<Prompt>();
|
||||
|
||||
/**
|
||||
* Column definitions for the prompts table
|
||||
* Defines how each column should be rendered and what data it displays
|
||||
*/
|
||||
export const columns = [
|
||||
// ID column - displays the prompt template ID
|
||||
columnHelper.accessor("id", {
|
||||
header: "ID",
|
||||
cell: (info) => <Code p={2}>{info.getValue()}</Code>,
|
||||
}),
|
||||
|
||||
// Prompt column - displays the prompt text content
|
||||
columnHelper.accessor("prompt", {
|
||||
header: "Prompt",
|
||||
cell: (info) => <Code p={2}>{info.getValue()}</Code>,
|
||||
}),
|
||||
|
||||
// Response type column - displays the expected response format
|
||||
columnHelper.accessor("responseType", {
|
||||
header: "Response",
|
||||
cell: (info) => {
|
||||
const value = info.getValue();
|
||||
return value === "json" ? "JSON" : "text";
|
||||
},
|
||||
}),
|
||||
|
||||
// Schema column - displays whether the prompt has a schema
|
||||
columnHelper.accessor("hasSchema", {
|
||||
header: "Schema?",
|
||||
cell: (info) => (info.getValue() ? "yes" : "no"),
|
||||
}),
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue