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

View File

@@ -15,7 +15,18 @@ export function ListToolsTempaltes({
}: Props) {
return (
<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" />
<div className="flex flex-wrap">
{templateTools.map((t, index) => (