完成初版聊天界面,开始进行读取本地聊天文件开发
This commit is contained in:
@@ -1,36 +1,58 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
// 引入各区域组件(后续创建)
|
||||
// 引入各区域组件
|
||||
import PresetPanel from './components/PresetPanel';
|
||||
import ChatBox from './components/ChatBox';
|
||||
import ImageDisplay from './components/ImageDisplay';
|
||||
import DicePanel from './components/DicePanel';
|
||||
import RoleSelector from './components/RoleSelector';
|
||||
|
||||
function App() {
|
||||
const [isToolbarExpanded, setIsToolbarExpanded] = useState(false);
|
||||
const [selectedRole, setSelectedRole] = useState(null);
|
||||
const [selectedChat, setSelectedChat] = useState(null);
|
||||
|
||||
const toggleToolbar = () => {
|
||||
setIsToolbarExpanded(!isToolbarExpanded);
|
||||
};
|
||||
|
||||
// 处理角色选择变化
|
||||
const handleRoleChange = (role) => {
|
||||
setSelectedRole(role);
|
||||
console.log('选择的角色:', role);
|
||||
// 这里可以添加其他逻辑,比如加载角色的聊天记录等
|
||||
};
|
||||
|
||||
// 处理聊天选择变化
|
||||
const handleChatChange = (role, chat) => {
|
||||
setSelectedChat(chat);
|
||||
console.log('选择的聊天:', role, chat);
|
||||
// 这里可以添加其他逻辑,比如加载聊天内容等
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="app-container">
|
||||
{/* 顶部工具栏 */}
|
||||
<header className={`toolbar ${isToolbarExpanded ? 'expanded' : ''}`}>
|
||||
<div className="toolbar-title">AI Chat Studio</div>
|
||||
{/* 工具栏内容区域 */}
|
||||
{isToolbarExpanded && (
|
||||
<div className="toolbar-content">
|
||||
{/* 角色选择器 */}
|
||||
<RoleSelector
|
||||
onRoleChange={handleRoleChange}
|
||||
onChatChange={handleChatChange}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 工具栏切换按钮 */}
|
||||
<button
|
||||
className="toolbar-toggle-btn"
|
||||
className={`toolbar-toggle-btn ${isToolbarExpanded ? 'expanded' : ''}`}
|
||||
onClick={toggleToolbar}
|
||||
aria-label="Toggle Toolbar"
|
||||
>
|
||||
{isToolbarExpanded ? '▼' : '▲'}
|
||||
</button>
|
||||
{/* 展开后的内容区域(预留) */}
|
||||
{isToolbarExpanded && (
|
||||
<div className="toolbar-content">
|
||||
{/* 工具栏内容待定 */}
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
|
||||
{/* 主体内容区域 */}
|
||||
|
||||
Reference in New Issue
Block a user