Skip to content

Commit

Permalink
feat(playground): allow hiding apiKey entry (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Jul 19, 2024
1 parent 446bdb2 commit 69ed202
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-starfishes-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@assistant-ui/react-playground": patch
---

feat: allow hiding apiKey input
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,10 @@ const MaxTokensSlider: FC = () => {
);
};

const Sidebar: FC<AssistantPlaygroundProps> = ({ modelSelector }) => {
const Sidebar: FC<AssistantPlaygroundProps> = ({
modelSelector,
apiKey = true,
}) => {
const { useAssistantActions } = useAssistantContext();
const handleReset = () => {
useAssistantActions.getState().switchToThread(null);
Expand All @@ -329,7 +332,7 @@ const Sidebar: FC<AssistantPlaygroundProps> = ({ modelSelector }) => {
<Button onClick={handleReset}>Reset</Button>

<ModelSelector {...modelSelector} />
<APIKeyInput />
{apiKey && <APIKeyInput />}
<TemperatureSlider />
<MaxTokensSlider />

Expand All @@ -347,17 +350,19 @@ type AssistantPlaygroundProps = {
models?: string[] | undefined;
}
| undefined;
apiKey?: boolean | undefined;
};

export const AssistantPlayground: FC<AssistantPlaygroundProps> = ({
modelSelector,
apiKey,
}) => {
return (
<div className="flex h-full overflow-hidden">
<div className="flex flex-grow flex-col">
<Thread />
</div>
<Sidebar modelSelector={modelSelector} />
<Sidebar modelSelector={modelSelector} apiKey={apiKey} />
</div>
);
};

0 comments on commit 69ed202

Please sign in to comment.