feat(chat): show playful teacher introductions on hover
This commit is contained in:
1 parent
b26e25c9ed
commit
772da4f8e4
16 files changed
+433
-62
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { ArrowUp, ChevronDown, ChevronRight, Loader2, Maximize2, Plus, X } from 'lucide-react';
|
||||
import { ArrowUp, ChevronDown, ChevronRight, Loader2 } from 'lucide-react';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { teacherApi, teacherTopicsPath, legacyTopicBase } from '@/lib/coding-teacher';
|
||||
import type {
|
||||
@@ -18,13 +18,10 @@ import { TeacherReply } from './TeacherReply';
|
||||
export function TeacherChatPanel({
|
||||
projectId,
|
||||
sourceId,
|
||||
onClose,
|
||||
onBringBack,
|
||||
quote,
|
||||
draftRevision,
|
||||
sampleContext,
|
||||
expanded,
|
||||
onExpand,
|
||||
externalTopic,
|
||||
onTopicChange,
|
||||
onComposingChange,
|
||||
@@ -32,14 +29,11 @@ export function TeacherChatPanel({
|
||||
}: {
|
||||
projectId: string;
|
||||
sourceId: string;
|
||||
onClose?(): void;
|
||||
onBringBack?(text: string): void;
|
||||
quote?: TeacherReference;
|
||||
draftRevision?: number;
|
||||
sampleContext?: string;
|
||||
projectName?: string;
|
||||
expanded?: boolean;
|
||||
onExpand?(): void;
|
||||
externalTopic?: TeacherTopic | null;
|
||||
onTopicChange?(topic: TeacherTopic): void;
|
||||
onComposingChange?(composing: boolean): void;
|
||||
@@ -384,10 +378,7 @@ export function TeacherChatPanel({
|
||||
<header className="consultation-header flex h-[68px] shrink-0 items-center gap-3 px-5">
|
||||
<TeacherAvatar className="consultation-avatar h-9 w-9 rounded-xl" definition={definition} />
|
||||
<div className="min-w-0 flex-1"><h2 className="truncate text-sm font-semibold">{definition?.name ?? '智能体'}</h2>
|
||||
<p className="mt-1 text-[11px] text-muted-foreground">{draftRevision ? '运营草稿试聊' : definition?.description}</p></div>
|
||||
<button aria-label={`${label}新话题`} title="新话题" disabled={busy || !enabled} onClick={() => void newTopic()} className="consult-icon"><Plus className="h-4 w-4" /></button>
|
||||
{onExpand && <button className="consult-icon" aria-label={expanded ? '恢复咨询栏宽度' : '展开咨询栏'} onClick={onExpand}><Maximize2 className="h-4 w-4" /></button>}
|
||||
{onClose && <button className="consult-icon" aria-label={`关闭${label}`} onClick={onClose}><X className="h-4 w-4" /></button>}
|
||||
{draftRevision && <p className="mt-1 text-[11px] text-muted-foreground">运营草稿试聊</p>}</div>
|
||||
</header>
|
||||
{(topics.items.length > 0 || draftRevision) && <div className="px-5 pt-2">
|
||||
<button className="text-[11px] text-muted-foreground" onClick={() => setHistoryOpen(!historyOpen)} aria-expanded={historyOpen}>以往讨论 <ChevronDown className="inline h-3 w-3" /></button>
|
||||
@@ -395,6 +386,8 @@ export function TeacherChatPanel({
|
||||
<select aria-label={`${label}话题`} value={topic?.id ?? ''} disabled={busy} onChange={(e) => void choose(e.target.value)} className="min-w-0 flex-1 rounded-lg border bg-background p-2 text-xs">
|
||||
{!topic && <option value="">选择话题</option>}{topics.items.map((item) => <option key={item.id} value={item.id}>{item.title}{item.legacyRole ? '(旧版,仅查看)' : ''}</option>)}
|
||||
</select>
|
||||
<button type="button" aria-label={`${label}新话题`} disabled={busy || !enabled} onClick={() => void newTopic()}
|
||||
className="shrink-0 rounded-lg px-2 text-xs text-muted-foreground hover:bg-white hover:text-foreground disabled:opacity-40">新话题</button>
|
||||
</div>}
|
||||
</div>}
|
||||
{discussionEnabled && topic?.discussion && <TeacherDiscussionPanel key={topic.id} discussion={topic.discussion}
|
||||
|
||||
Reference in new issue
Block a user