make it easy for people to use sk-litellm

This commit is contained in:
Krrish Dholakia 2023-09-18 14:08:05 -07:00
parent 633e36de42
commit e6a022ea9e
5 changed files with 69 additions and 27 deletions

View file

@ -0,0 +1,34 @@
import React, { useState, useEffect } from 'react';
import {v4 as uuidv4} from 'uuid';
const CodeBlock = ({ token }) => {
const codeWithToken = `${token}`;
return (
<pre>
{token ? codeWithToken : ""}
</pre>
);
};
const TokenGen = () => {
const [token, setToken] = useState(null);
useEffect(() => {
const generateToken = () => {
// Generate a special uuid/token "sk-litellm-<uuid>"
const newToken = `sk-litellm-${uuidv4()}`;
setToken(newToken);
};
generateToken();
}, []);
return (
<div>
<CodeBlock token={token} />
</div>
);
};
export default TokenGen;