feat(webui): polish agent output and app discovery
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { faviconUrls, logoFallbackUrls, providerBrand } from "@/lib/provider-brand";
|
||||
import {
|
||||
browserSafeFaviconUrls,
|
||||
faviconUrls,
|
||||
isGenericRepositoryLogoUrl,
|
||||
logoFallbackUrls,
|
||||
providerBrand,
|
||||
} from "@/lib/provider-brand";
|
||||
|
||||
describe("provider brand logos", () => {
|
||||
it("uses multiple favicon sources before falling back to initials", () => {
|
||||
@@ -11,6 +17,15 @@ describe("provider brand logos", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("uses cross-origin-safe favicon sources first for arbitrary web pages", () => {
|
||||
expect(browserSafeFaviconUrls("openai.com")).toEqual([
|
||||
"https://favicon.im/openai.com?larger=true",
|
||||
"https://www.google.com/s2/favicons?domain=openai.com&sz=64",
|
||||
"https://icons.duckduckgo.com/ip3/openai.com.ico",
|
||||
"https://openai.com/favicon.ico",
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps explicit Google favicon URLs first before trying fallbacks", () => {
|
||||
expect(logoFallbackUrls("https://www.google.com/s2/favicons?domain=browserbase.com&sz=64")).toEqual([
|
||||
"https://www.google.com/s2/favicons?domain=browserbase.com&sz=64",
|
||||
@@ -28,6 +43,17 @@ describe("provider brand logos", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("distinguishes repository host favicons from product identities", () => {
|
||||
expect(
|
||||
isGenericRepositoryLogoUrl(
|
||||
"https://www.google.com/s2/favicons?domain=github.com/HKUDS/CLI-Anything&sz=64",
|
||||
),
|
||||
).toBe(true);
|
||||
expect(isGenericRepositoryLogoUrl("https://github.com/favicon.ico")).toBe(true);
|
||||
expect(isGenericRepositoryLogoUrl("https://raw.githubusercontent.com/org/repo/logo.svg")).toBe(false);
|
||||
expect(isGenericRepositoryLogoUrl("https://blender.org/favicon.ico")).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps Zhipu on the current Z.ai brand domain", () => {
|
||||
expect(providerBrand("zhipu")?.logoUrls[0]).toBe("https://z-cdn.chatglm.cn/z-ai/static/logo.svg");
|
||||
expect(providerBrand("zhipu")?.logoUrls).toContain("https://www.google.com/s2/favicons?domain=z.ai&sz=64");
|
||||
|
||||
Reference in New Issue
Block a user