🤖 添加虚拟坐席功能

后端:
- 创建会议时自动添加虚拟龙虾参会者
- 如果指定了 host_agent_id,添加该龙虾
- 否则添加 2 个虚拟助手(🤖🦊)

前端:
- 创建会议时可选"添加虚拟坐席"
- 默认勾选,方便测试 @ 功能
- 提示文字说明用途

使用场景:
- 用户创建会议 → 自动有虚拟龙虾
- 点击虚拟龙虾座位 → @ 该龙虾
- 测试 @ 功能无需真实龙虾在线
This commit is contained in:
2026-04-04 13:04:26 +08:00
parent 598e55794a
commit 845817a028
3 changed files with 89 additions and 1 deletions

View File

@@ -136,6 +136,7 @@ function LoginPage() {
function MeetingList() {
const [meetings, setMeetings] = useState([]);
const [topic, setTopic] = useState('');
const [autoAddAgents, setAutoAddAgents] = useState(true);
const navigate = useNavigate();
const token = localStorage.getItem('token');
@@ -154,7 +155,10 @@ function MeetingList() {
const createMeeting = async (e) => {
e.preventDefault();
try {
const res = await axios.post(`${API_BASE}/meetings/`, { topic });
const res = await axios.post(`${API_BASE}/meetings/`, {
topic,
auto_add_virtual_agents: autoAddAgents
});
navigate(`/meeting/${res.data.id}`);
} catch (error) {
alert('创建失败:' + (error.response?.data?.detail || error.message));
@@ -173,8 +177,19 @@ function MeetingList() {
<h2>创建会议</h2>
<form onSubmit={createMeeting} style={styles.form}>
<input type="text" placeholder="会议主题" value={topic} onChange={e => setTopic(e.target.value)} style={styles.input} required />
<label style={{display: 'flex', alignItems: 'center', gap: '5px', whiteSpace: 'nowrap'}}>
<input
type="checkbox"
checked={autoAddAgents}
onChange={e => setAutoAddAgents(e.target.checked)}
/>
添加虚拟坐席
</label>
<button type="submit" style={styles.btn}>创建</button>
</form>
<p style={{fontSize: '12px', color: '#666', marginTop: '10px'}}>
💡 勾选"添加虚拟坐席"会自动创建 2 个虚拟龙虾参会者方便测试 @ 功能
</p>
</div>
<div style={styles.list}>
{meetings.map(m => (