fix Owliver ai chat

This commit is contained in:
2026-08-10 13:19:10 +05:30
parent 52fe6d9c14
commit 76412b08b4
8 changed files with 57 additions and 272 deletions

View File

@@ -5,7 +5,7 @@ import { Surface } from '@/components/ds/Surface';
import { IconButton } from '@/components/ds/IconButton';
import { Alert } from '@/components/ds/Alert';
import { KROW_LOGO_URL } from '@/assets/brand';
import { useAssistantFacts, useConversation } from './useAssistant';
import { useAssistantFacts, useConversation, useCurrentUserName } from './useAssistant';
import { buildIntro, buildPrompts } from './dynamic';
import { Message, ThinkingIndicator, TurnDivider } from './AssistantMessage';
import { PromptInput } from './PromptInput';
@@ -43,7 +43,8 @@ export default function KrowAssistant({
onExpand,
onRestore,
}) {
const facts = useAssistantFacts({ needsWorkerProfile: context.needsWorkerProfile });
const facts = useAssistantFacts();
const userName = useCurrentUserName();
const { messages, pending, error, busy, send, stop, reset } = useConversation({
contextId: context.id,
facts,
@@ -56,8 +57,8 @@ export default function KrowAssistant({
/* Greeting and suggestions come from live data, so they recompute only when
the data or the page actually changes. */
const intro = React.useMemo(
() => buildIntro(context.id, facts, facts.profile?.full_name),
[context.id, facts]
() => buildIntro(context.id, facts, userName),
[context.id, facts, userName]
);
const prompts = React.useMemo(() => buildPrompts(context.id, facts), [context.id, facts]);