You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.1 KiB

1 month ago
import uuid
from dash import html, dcc
import feffery_antd_components as fac
import feffery_utils_components as fuc
from server import app, server # noqa: F401
# 绑定回调
import callbacks.dataint_c.dataint_c
# from api.test import get_test_list_api
from .components import (
# header_bar,
chat_area,
input_area,
setting_modal,
chat_export_modal,
)
from conversation_cache import conversation_cache
def render(*args, **kwargs):
# # 生成唯一识别对话id
conversation_id = str(uuid.uuid4())
# # 初始化当前对话缓存
conversation_cache.insert(
conversation_id,
[],
)
return fac.AntdConfigProvider(
[
# 分配唯一对话id
dcc.Store(id="conversation-id", data=conversation_id),
# 页面重载或关闭事件监听
fuc.FefferyListenUnload(id="listen-unload"),
# 全局消息提示
fac.Fragment(id="global-message"),
fac.AntdCenter(
[
# 对话框容器
html.Div(
[
# 顶部栏
# header_bar.render(),
# 对话区域
chat_area.render(conversation_id),
# 底部输入区域
input_area.render(),
],
id="chat-container",
style={
"width": "280vw",
"height": "85vh",
"maxWidth": 1350,
"borderRadius": 16,
# "border": "1px solid #dedede",
"border": "none",
},
),
# 设置中心模态框
setting_modal.render(),
# 对话导出模态框
chat_export_modal.render(),
],
style={"height": "85vh"},
),
]
)