Enhance ListAPIs component to display template name conditionally; update ChatBOX layout for improved spacing

This commit is contained in:
ecwu
2024-12-21 13:13:36 +08:00
parent e8f0c0ffa5
commit f2feedd3a2
2 changed files with 19 additions and 3 deletions

View File

@@ -34,7 +34,23 @@ export function ListAPIs({
}: Props) {
return (
<NavigationMenuItem>
<NavigationMenuTrigger>{label}</NavigationMenuTrigger>
<NavigationMenuTrigger>
{label}{" "}
<span className="hidden lg:inline">
{tmps.find(
(t) =>
chatStore[apiField as keyof ChatStore] === t.endpoint &&
chatStore[keyField as keyof ChatStore] === t.key
)?.name &&
`: ${
tmps.find(
(t) =>
chatStore[apiField as keyof ChatStore] === t.endpoint &&
chatStore[keyField as keyof ChatStore] === t.key
)?.name
}`}
</span>
</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="grid w-[400px] gap-3 p-4 md:w-[500px] md:grid-cols-2 lg:w-[600px] ">
{tmps.map((t, index) => (
@@ -60,7 +76,7 @@ export function ListAPIs({
{t.name}
</div>
<p className="line-clamp-2 text-sm leading-snug text-muted-foreground">
{label === "API" ? t.endpoint : t.key}
{new URL(t.endpoint).host}
</p>
</a>
</NavigationMenuLink>

View File

@@ -457,7 +457,7 @@ export default function ChatBOX(props: {
return (
<>
<div className="flex flex-col w-full">
<div className="flex flex-col p-2 gap-2 w-full">
{true && (
<Settings
chatStore={chatStore}