save whisper / tts / image gen api
This commit is contained in:
39
src/setAPIsTemplate.tsx
Normal file
39
src/setAPIsTemplate.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { TemplateAPI } from "./app";
|
||||
import { Tr } from "./translate";
|
||||
|
||||
interface Props {
|
||||
tmps: TemplateAPI[];
|
||||
setTmps: (tmps: TemplateAPI[]) => void;
|
||||
label: string;
|
||||
endpoint: string;
|
||||
APIkey: string;
|
||||
}
|
||||
export function SetAPIsTemplate({
|
||||
endpoint,
|
||||
APIkey,
|
||||
tmps,
|
||||
setTmps,
|
||||
label,
|
||||
}: Props) {
|
||||
return (
|
||||
<button
|
||||
className="p-2 m-2 rounded bg-blue-300"
|
||||
onClick={() => {
|
||||
const name = prompt(`Give this **${label}** template a name:`);
|
||||
if (!name) {
|
||||
alert("No template name specified");
|
||||
return;
|
||||
}
|
||||
const tmp: TemplateAPI = {
|
||||
name,
|
||||
endpoint,
|
||||
key: APIkey,
|
||||
};
|
||||
tmps.push(tmp);
|
||||
setTmps([...tmps]);
|
||||
}}
|
||||
>
|
||||
{Tr(`Save ${label}`)}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user