feat: update ADK debate tab with latest improvements
This commit is contained in:
parent
91d20868da
commit
f65ef78d10
|
|
@ -9,9 +9,27 @@ from typing import Dict, Any, List
|
|||
project_root = Path(__file__).parent.parent.parent
|
||||
sys.path.insert(0, str(project_root))
|
||||
|
||||
from google.adk import Agent, Runner
|
||||
from google.adk.sessions import InMemorySessionService, Session
|
||||
from google.genai import types
|
||||
try:
|
||||
from google.adk import Agent, Runner
|
||||
from google.adk.sessions import InMemorySessionService, Session
|
||||
from google.genai import types
|
||||
ADK_AVAILABLE = True
|
||||
except ImportError:
|
||||
ADK_AVAILABLE = False
|
||||
# 创建占位符类
|
||||
class Agent:
|
||||
pass
|
||||
class Runner:
|
||||
pass
|
||||
class InMemorySessionService:
|
||||
pass
|
||||
class Session:
|
||||
pass
|
||||
class types:
|
||||
class Content:
|
||||
pass
|
||||
class Part:
|
||||
pass
|
||||
|
||||
async def _get_llm_reply(runner: Runner, session: Session, prompt: str) -> str:
|
||||
"""Helper function to call a Runner and get a text reply."""
|
||||
|
|
@ -113,6 +131,22 @@ async def run_adk_debate_streamlit(topic: str, participants: List[str], rounds:
|
|||
|
||||
def render_adk_debate_tab():
|
||||
"""Renders the Streamlit UI for the ADK Debate tab."""
|
||||
|
||||
# 检查 ADK 是否可用
|
||||
if not ADK_AVAILABLE:
|
||||
st.error("🚫 Google ADK 模块未安装或不可用")
|
||||
st.info("📦 正在安装 Google ADK,请稍候...")
|
||||
st.info("💡 安装完成后请刷新页面")
|
||||
|
||||
with st.expander("📋 安装说明"):
|
||||
st.code("""
|
||||
# 安装 Google ADK
|
||||
pip install google-adk>=1.12.0
|
||||
|
||||
# 或从 GitHub 安装开发版
|
||||
pip install git+https://github.com/google/adk-python.git@main
|
||||
""")
|
||||
return
|
||||
st.markdown("### 🏛️ 八仙论道 (ADK版 - 太上老君主持)")
|
||||
|
||||
topic = st.text_input(
|
||||
|
|
|
|||
Loading…
Reference in New Issue