-
Notifications
You must be signed in to change notification settings - Fork 0
feat(playground): add Chat UI and comparison testing #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1491c7e
style: apply code formatter
pescn b4db656
feat(playground): add database schema, migrations, and queries
pescn 770980c
feat(playground): add backend admin API endpoints
pescn 8167729
feat(playground): add frontend chat and comparison testing UI
pescn 8477783
fix(playground): address code review feedback
pescn aa45dc9
fix(playground): address follow-up code review feedback
pescn 21ef39d
fix(playground): add FK cascade/set-null actions and atomic test run …
pescn b300d09
fix(playground): add message insert null check, TTFT translation, and…
pescn 372b687
fix(playground): validate testCaseId, fail transaction on insert erro…
pescn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| CREATE TYPE "public"."playground_message_role" AS ENUM('system', 'user', 'assistant');--> statement-breakpoint | ||
| CREATE TYPE "public"."playground_test_result_status" AS ENUM('pending', 'running', 'completed', 'failed');--> statement-breakpoint | ||
| CREATE TABLE "playground_conversations" ( | ||
| "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "playground_conversations_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), | ||
| "title" varchar(255) NOT NULL, | ||
| "model" varchar(63) NOT NULL, | ||
| "api_key_id" integer, | ||
| "params" jsonb, | ||
| "created_at" timestamp DEFAULT now() NOT NULL, | ||
| "updated_at" timestamp DEFAULT now() NOT NULL, | ||
| "deleted" boolean DEFAULT false NOT NULL | ||
| ); | ||
| --> statement-breakpoint | ||
| CREATE TABLE "playground_messages" ( | ||
| "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "playground_messages_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), | ||
| "conversation_id" integer NOT NULL, | ||
| "role" "playground_message_role" NOT NULL, | ||
| "content" varchar NOT NULL, | ||
| "completion_id" integer, | ||
| "created_at" timestamp DEFAULT now() NOT NULL | ||
| ); | ||
| --> statement-breakpoint | ||
| CREATE TABLE "playground_test_cases" ( | ||
| "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "playground_test_cases_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), | ||
| "title" varchar(255) NOT NULL, | ||
| "description" varchar, | ||
| "messages" jsonb NOT NULL, | ||
| "params" jsonb, | ||
| "created_at" timestamp DEFAULT now() NOT NULL, | ||
| "updated_at" timestamp DEFAULT now() NOT NULL, | ||
| "deleted" boolean DEFAULT false NOT NULL | ||
| ); | ||
| --> statement-breakpoint | ||
| CREATE TABLE "playground_test_results" ( | ||
| "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "playground_test_results_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), | ||
| "test_run_id" integer NOT NULL, | ||
| "model" varchar(63) NOT NULL, | ||
| "status" "playground_test_result_status" DEFAULT 'pending' NOT NULL, | ||
| "response" varchar, | ||
| "prompt_tokens" integer, | ||
| "completion_tokens" integer, | ||
| "ttft" integer, | ||
| "duration" integer, | ||
| "error_message" varchar, | ||
| "completion_id" integer, | ||
| "created_at" timestamp DEFAULT now() NOT NULL, | ||
| "updated_at" timestamp DEFAULT now() NOT NULL | ||
| ); | ||
| --> statement-breakpoint | ||
| CREATE TABLE "playground_test_runs" ( | ||
| "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "playground_test_runs_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), | ||
| "test_case_id" integer NOT NULL, | ||
| "api_key_id" integer, | ||
| "models" jsonb NOT NULL, | ||
| "created_at" timestamp DEFAULT now() NOT NULL, | ||
| "deleted" boolean DEFAULT false NOT NULL | ||
| ); | ||
| --> statement-breakpoint | ||
| ALTER TABLE "playground_conversations" ADD CONSTRAINT "playground_conversations_api_key_id_api_keys_id_fk" FOREIGN KEY ("api_key_id") REFERENCES "public"."api_keys"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_messages" ADD CONSTRAINT "playground_messages_conversation_id_playground_conversations_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."playground_conversations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_messages" ADD CONSTRAINT "playground_messages_completion_id_completions_id_fk" FOREIGN KEY ("completion_id") REFERENCES "public"."completions"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_test_results" ADD CONSTRAINT "playground_test_results_test_run_id_playground_test_runs_id_fk" FOREIGN KEY ("test_run_id") REFERENCES "public"."playground_test_runs"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_test_results" ADD CONSTRAINT "playground_test_results_completion_id_completions_id_fk" FOREIGN KEY ("completion_id") REFERENCES "public"."completions"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_test_runs" ADD CONSTRAINT "playground_test_runs_test_case_id_playground_test_cases_id_fk" FOREIGN KEY ("test_case_id") REFERENCES "public"."playground_test_cases"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_test_runs" ADD CONSTRAINT "playground_test_runs_api_key_id_api_keys_id_fk" FOREIGN KEY ("api_key_id") REFERENCES "public"."api_keys"("id") ON DELETE no action ON UPDATE no action; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| ALTER TABLE "playground_conversations" DROP CONSTRAINT "playground_conversations_api_key_id_api_keys_id_fk"; | ||
| --> statement-breakpoint | ||
| ALTER TABLE "playground_messages" DROP CONSTRAINT "playground_messages_conversation_id_playground_conversations_id_fk"; | ||
| --> statement-breakpoint | ||
| ALTER TABLE "playground_messages" DROP CONSTRAINT "playground_messages_completion_id_completions_id_fk"; | ||
| --> statement-breakpoint | ||
| ALTER TABLE "playground_test_results" DROP CONSTRAINT "playground_test_results_test_run_id_playground_test_runs_id_fk"; | ||
| --> statement-breakpoint | ||
| ALTER TABLE "playground_test_results" DROP CONSTRAINT "playground_test_results_completion_id_completions_id_fk"; | ||
| --> statement-breakpoint | ||
| ALTER TABLE "playground_test_runs" DROP CONSTRAINT "playground_test_runs_test_case_id_playground_test_cases_id_fk"; | ||
| --> statement-breakpoint | ||
| ALTER TABLE "playground_test_runs" DROP CONSTRAINT "playground_test_runs_api_key_id_api_keys_id_fk"; | ||
| --> statement-breakpoint | ||
| ALTER TABLE "playground_conversations" ADD CONSTRAINT "playground_conversations_api_key_id_api_keys_id_fk" FOREIGN KEY ("api_key_id") REFERENCES "public"."api_keys"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_messages" ADD CONSTRAINT "playground_messages_conversation_id_playground_conversations_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."playground_conversations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_messages" ADD CONSTRAINT "playground_messages_completion_id_completions_id_fk" FOREIGN KEY ("completion_id") REFERENCES "public"."completions"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_test_results" ADD CONSTRAINT "playground_test_results_test_run_id_playground_test_runs_id_fk" FOREIGN KEY ("test_run_id") REFERENCES "public"."playground_test_runs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_test_results" ADD CONSTRAINT "playground_test_results_completion_id_completions_id_fk" FOREIGN KEY ("completion_id") REFERENCES "public"."completions"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_test_runs" ADD CONSTRAINT "playground_test_runs_test_case_id_playground_test_cases_id_fk" FOREIGN KEY ("test_case_id") REFERENCES "public"."playground_test_cases"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "playground_test_runs" ADD CONSTRAINT "playground_test_runs_api_key_id_api_keys_id_fk" FOREIGN KEY ("api_key_id") REFERENCES "public"."api_keys"("id") ON DELETE set null ON UPDATE no action; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.