MCPcopy Create free account
hub / github.com/acgurl/mori / create_interface

Method create_interface

gui/app.py:71–99  ·  view source on GitHub ↗

创建Gradio聊天界面 Returns: Gradio ChatInterface对象

(self)

Source from the content-addressed store, hash-verified

69 yield "抱歉,系统出现了意外错误。请稍后重试。"
70
71 def create_interface(self) -> gr.ChatInterface:
72 """创建Gradio聊天界面
73
74 Returns:
75 Gradio ChatInterface对象
76 """
77 # 获取主agent配置信息
78 primary_agent_name = self.mori.get_primary_agent_name()
79 primary_agent_config = self.config.agents.get(primary_agent_name)
80 primary_agent = self.mori.primary_agent
81
82 description = f"""
83 欢迎来到Mori的世界!我会用心陪伴你,倾听你的心声。✨
84
85 **当前配置**: 主Agent: {primary_agent_name} | 模型: {primary_agent_config.model if primary_agent_config else 'N/A'} | 工具: {len(primary_agent.toolkit.get_json_schemas())} 个
86 """
87
88 chat_interface = gr.ChatInterface(
89 fn=self.respond,
90 title="💕 Mori - 你的虚拟AI女友",
91 description=description,
92 examples=[
93 "你好,今天过得怎么样?",
94 "我今天心情不太好...",
95 "给我讲个有趣的故事吧",
96 ],
97 )
98
99 return chat_interface
100
101 def launch(
102 self,

Callers 1

launchMethod · 0.95

Calls 2

getMethod · 0.45

Tested by

no test coverage detected