feat(ui_sso.py): Allows users to use test key pane, and have team budget limits be enforced for their use-case (#7666)

This commit is contained in:
Krish Dholakia 2025-01-09 22:12:45 -08:00 committed by GitHub
parent 6df8faf15f
commit 63926f484c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 47 additions and 2 deletions

View file

@ -35,6 +35,7 @@ interface ChatUIProps {
token: string | null;
userRole: string | null;
userID: string | null;
disabledPersonalKeyCreation: boolean;
}
async function generateModelResponse(
@ -81,8 +82,11 @@ const ChatUI: React.FC<ChatUIProps> = ({
token,
userRole,
userID,
disabledPersonalKeyCreation,
}) => {
const [apiKeySource, setApiKeySource] = useState<'session' | 'custom'>('session');
const [apiKeySource, setApiKeySource] = useState<'session' | 'custom'>(
disabledPersonalKeyCreation ? 'custom' : 'session'
);
const [apiKey, setApiKey] = useState("");
const [inputMessage, setInputMessage] = useState("");
const [chatHistory, setChatHistory] = useState<{ role: string; content: string; model?: string }[]>([]);
@ -240,6 +244,7 @@ const ChatUI: React.FC<ChatUIProps> = ({
<Col>
<Text>API Key Source</Text>
<Select
disabled={disabledPersonalKeyCreation}
defaultValue="session"
style={{ width: "100%" }}
onChange={(value) => setApiKeySource(value as "session" | "custom")}