fix internet search icons / text + assistants tab (#1862)

This commit is contained in:
pablodanswer 2024-07-18 16:15:19 -07:00 committed by GitHub
parent 5230f7e22f
commit 2dc7e64dd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 13 deletions

View File

@ -143,6 +143,7 @@ export default function SidebarWrapper<T extends object>({
<div className="mt-4 mx-auto">{content(contentProps)}</div>
</div>
</div>
<FixedLogo />
</div>
);
}

View File

@ -67,9 +67,6 @@ export default async function GalleryPage({
user={user}
assistants={assistants}
/>
{/* Temporary - fixed logo */}
<FixedLogo />
</ChatProvider>
</>
);

View File

@ -57,6 +57,8 @@ import {
import { ValidSources } from "@/lib/types";
import { Tooltip } from "@/components/tooltip/Tooltip";
import { useMouseTracking } from "./hooks";
import { InternetSearchIcon } from "@/components/InternetSearchIcon";
import { getTitleFromDocument } from "@/lib/sources";
const TOOLS_WITH_CUSTOM_HANDLING = [
SEARCH_TOOL_NAME,
@ -443,17 +445,17 @@ export const AIMessage = ({
>
<Citation link={doc.link} index={ind + 1} />
<p className="shrink truncate ellipsis break-all ">
{
doc.document_id.split("/")[
doc.document_id.split("/").length - 1
]
}
{getTitleFromDocument(doc)}
</p>
<div className="ml-auto flex-none">
{doc.is_internet ? (
<InternetSearchIcon url={doc.link} />
) : (
<SourceIcon
sourceType={doc.source_type}
iconSize={18}
/>
)}
</div>
</a>
<div className="flex overscroll-x-scroll mt-.5">

View File

@ -38,7 +38,11 @@ import {
ColorSlackIcon,
} from "@/components/icons/icons";
import { ValidSources } from "./types";
import { SourceCategory, SourceMetadata } from "./search/interfaces";
import {
DanswerDocument,
SourceCategory,
SourceMetadata,
} from "./search/interfaces";
import { Persona } from "@/app/admin/assistants/interfaces";
import { FaAccessibleIcon, FaSlack } from "react-icons/fa";
@ -290,3 +294,16 @@ export function getSourcesForPersona(persona: Persona): ValidSources[] {
});
return personaSources;
}
function stripTrailingSlash(str: string) {
if (str.substr(-1) === "/") {
return str.substr(0, str.length - 1);
}
return str;
}
export const getTitleFromDocument = (document: DanswerDocument) => {
return stripTrailingSlash(document.document_id).split("/")[
stripTrailingSlash(document.document_id).split("/").length - 1
];
};