Spaces:
Sleeping
Sleeping
remove reset
Browse files76 unmodified lines7778798081828384858676 unmodified linesprint("✅ BasicAgent initialized.")async def answer_once(self, prompt: str) -> str:"""Ask one question, then clear the dialogue so tokens never pile up."""reply = await self.agent.run(prompt)self.agent.reset() # <<< flush conversation contextreturn replyasync def __call__(self, input_text: str):# Use run() within async context76 unmodified lines7778798081828384858687888976 unmodified linesprint("✅ BasicAgent initialized.")async def answer_once(self, prompt: str) -> str:"""Run the agent in a blank context so tokens never pile up."""# Safety: trim monster inputs# prompt = prompt[:32000] # ≈ 2 k tokens head-roomctx = Context(self.agent) # no prior messagesresp = await self.agent.run(user_msg=prompt, ctx=ctx)# run() sometimes returns dict, sometimes strreturn resp if isinstance(resp, str) else resp.get("response", str(resp))async def __call__(self, input_text: str):# Use run() within async context
app.py+7-4