Update app.py
Browse files9 unmodified lines1011121314151617181915202122231718192024252627282930319 unmodified lines
# --- Basic Agent Definition ---# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
from smolagents import CodeAgentfrom smolagents.models import OpenAIChatfrom my_tools import my_tool_list # 你需要新建/补全这个模块和列表
class BasicAgent: def __init__(self): print("BasicAgent initialized.") model = OpenAIChat(model="gpt-4.1") self.agent = CodeAgent(model=model, tools=my_tool_list, max_steps=6) def __call__(self, question: str) -> str: print(f"Agent received question (first 50 chars): {question[:50]}...") fixed_answer = "This is a default answer." print(f"Agent returning fixed answer: {fixed_answer}") return fixed_answer print(f"Agent received question: {question[:80]}...") try: return self.agent.run(question) except Exception as e: return f"[Agent Error: {e}]"
def run_and_submit_all( profile: gr.OAuthProfile | None): """app.py+13-5