Skip to content

Commit

Permalink
update initial instance id
Browse files Browse the repository at this point in the history
  • Loading branch information
Parker-Stafford committed Oct 7, 2024
1 parent bf9bc78 commit fabb2e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/src/pages/playground/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { PlaygroundInstance } from "@phoenix/store";
import {

Check failure on line 1 in app/src/pages/playground/utils.ts

View workflow job for this annotation

GitHub Actions / CI Typescript

Run autofix to sort these imports!
INITIAL_PLAYGROUND_INSTANCE_ID,
PlaygroundInstance,
} from "@phoenix/store";
import { spanPlaygroundPageLoaderQuery$data } from "./__generated__/spanPlaygroundPageLoaderQuery.graphql";
import { safelyParseJSON } from "@phoenix/utils/jsonUtils";
import { llmAttributesSchema } from "./schemas";
Expand All @@ -22,7 +25,7 @@ export function transformSpanAttributesToPlaygroundInstance(
throw new Error("Invalid data");
}
return {
id: 1,
id: INITIAL_PLAYGROUND_INSTANCE_ID,
activeRunId: null,
isRunning: false,
input: {
Expand Down
6 changes: 5 additions & 1 deletion app/src/store/playgroundStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { devtools } from "zustand/middleware";

export type GenAIOperationType = "chat" | "text_completion";

let playgroundInstanceIdIndex = 0;
export const INITIAL_PLAYGROUND_INSTANCE_ID = 0;
let playgroundInstanceIdIndex = INITIAL_PLAYGROUND_INSTANCE_ID;
let playgroundRunIdIndex = 0;

/**
Expand Down Expand Up @@ -182,6 +183,9 @@ const DEFAULT_TEXT_COMPLETION_TEMPLATE: PlaygroundTextCompletionTemplate = {
export const createPlaygroundStore = (
initialProps?: Partial<PlaygroundProps>
) => {
if (initialProps?.instances != null && initialProps.instances.length > 0) {
playgroundInstanceIdIndex += initialProps.instances.length;
}
const playgroundStore: StateCreator<PlaygroundState> = (set, get) => ({
operationType: "chat",
inputMode: "manual",
Expand Down

0 comments on commit fabb2e3

Please sign in to comment.