show all saved apis

This commit is contained in:
2024-01-16 17:48:41 +08:00
parent 36f2ce57d5
commit 0eabcc0d0a
2 changed files with 64 additions and 72 deletions

View File

@@ -464,11 +464,7 @@ export default function ChatBOX(props: {
{Tr("Please click above to set")} API Endpoint {Tr("Please click above to set")} API Endpoint
</p> </p>
)} )}
{templateAPIs.length > 0 && {templateAPIs.length > 0 && (
(chatStore.develop_mode ||
chatStore.history.filter((msg) => !msg.example).length == 0 ||
!chatStore.apiEndpoint ||
!chatStore.apiKey) && (
<ListAPIs <ListAPIs
label="API" label="API"
tmps={templateAPIs} tmps={templateAPIs}
@@ -480,11 +476,7 @@ export default function ChatBOX(props: {
/> />
)} )}
{templateAPIsWhisper.length > 0 && {templateAPIsWhisper.length > 0 && (
(chatStore.develop_mode ||
chatStore.history.filter((msg) => !msg.example).length == 0 ||
!chatStore.whisper_api ||
!chatStore.whisper_key) && (
<ListAPIs <ListAPIs
label="Whisper API" label="Whisper API"
tmps={templateAPIsWhisper} tmps={templateAPIsWhisper}
@@ -496,11 +488,7 @@ export default function ChatBOX(props: {
/> />
)} )}
{templateAPIsTTS.length > 0 && {templateAPIsTTS.length > 0 && (
(chatStore.develop_mode ||
chatStore.history.filter((msg) => !msg.example).length == 0 ||
!chatStore.tts_api ||
!chatStore.tts_key) && (
<ListAPIs <ListAPIs
label="TTS API" label="TTS API"
tmps={templateAPIsTTS} tmps={templateAPIsTTS}
@@ -512,11 +500,7 @@ export default function ChatBOX(props: {
/> />
)} )}
{templateAPIsImageGen.length > 0 && {templateAPIsImageGen.length > 0 && (
(chatStore.develop_mode ||
chatStore.history.filter((msg) => !msg.example).length == 0 ||
!chatStore.image_gen_api ||
!chatStore.image_gen_key) && (
<ListAPIs <ListAPIs
label="Image Gen API" label="Image Gen API"
tmps={templateAPIsImageGen} tmps={templateAPIsImageGen}
@@ -528,10 +512,7 @@ export default function ChatBOX(props: {
/> />
)} )}
{toolsTemplates.length > 0 && {toolsTemplates.length > 0 && (
(chatStore.develop_mode ||
chatStore.history.filter((msg) => !msg.example).length == 0 ||
!chatStore.toolsString) && (
<ListToolsTempaltes <ListToolsTempaltes
templateTools={toolsTemplates} templateTools={toolsTemplates}
setTemplateTools={setTemplateTools} setTemplateTools={setTemplateTools}

View File

@@ -15,7 +15,18 @@ export function ListToolsTempaltes({
}: Props) { }: Props) {
return ( return (
<div className="break-all opacity-80 p-3 rounded bg-white my-3 text-left dark:text-black"> <div className="break-all opacity-80 p-3 rounded bg-white my-3 text-left dark:text-black">
<h2>{Tr(`Saved tools templates`)}</h2> <h2>
<span>{Tr(`Saved tools templates`)}</span>
<button
className="mx-2 underline cursor-pointer"
onClick={() => {
chatStore.toolsString = "";
setChatStore({ ...chatStore });
}}
>
{Tr(`Clear`)}
</button>
</h2>
<hr className="my-2" /> <hr className="my-2" />
<div className="flex flex-wrap"> <div className="flex flex-wrap">
{templateTools.map((t, index) => ( {templateTools.map((t, index) => (