mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-07 19:38:19 +02:00
ensure assistant response parsed correctly (#2823)
This commit is contained in:
parent
0a0215ceee
commit
f3fb7c572e
@ -9,7 +9,10 @@ import { redirect } from "next/navigation";
|
||||
import { BackendChatSession } from "../../interfaces";
|
||||
import { SharedChatDisplay } from "./SharedChatDisplay";
|
||||
import { Persona } from "@/app/admin/assistants/interfaces";
|
||||
import { fetchAssistantsSS } from "@/lib/assistants/fetchAssistantsSS";
|
||||
import {
|
||||
FetchAssistantsResponse,
|
||||
fetchAssistantsSS,
|
||||
} from "@/lib/assistants/fetchAssistantsSS";
|
||||
import FunctionalHeader from "@/components/chat_search/Header";
|
||||
import { defaultPersona } from "@/app/admin/assistants/lib";
|
||||
|
||||
@ -44,7 +47,8 @@ export default async function Page({ params }: { params: { chatId: string } }) {
|
||||
const authTypeMetadata = results[0] as AuthTypeMetadata | null;
|
||||
const user = results[1] as User | null;
|
||||
const chatSession = results[2] as BackendChatSession | null;
|
||||
const availableAssistants = results[3] as Persona[] | null;
|
||||
const assistantsResponse = results[3] as FetchAssistantsResponse | null;
|
||||
const [availableAssistants, _] = assistantsResponse ?? [[], null];
|
||||
|
||||
const authDisabled = authTypeMetadata?.authType === "disabled";
|
||||
if (!authDisabled && !user) {
|
||||
@ -54,11 +58,12 @@ export default async function Page({ params }: { params: { chatId: string } }) {
|
||||
if (user && !user.is_verified && authTypeMetadata?.requiresVerification) {
|
||||
return redirect("/auth/waiting-on-verification");
|
||||
}
|
||||
const persona = chatSession?.persona_id
|
||||
? (availableAssistants?.find((p) => p.id === chatSession.persona_id) ??
|
||||
availableAssistants?.[0] ??
|
||||
null)
|
||||
: (availableAssistants?.[0] ?? defaultPersona);
|
||||
|
||||
const persona: Persona =
|
||||
chatSession?.persona_id && availableAssistants?.length
|
||||
? (availableAssistants.find((p) => p.id === chatSession.persona_id) ??
|
||||
defaultPersona)
|
||||
: (availableAssistants?.[0] ?? defaultPersona);
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user