This commit is contained in:
2024-12-21 18:57:39 +01:00
parent 4e98292160
commit 42a4449472
5 changed files with 112 additions and 56 deletions

View File

@ -8,6 +8,8 @@
# source code released under the terms of GNU Public License Version 3
# https://www.gnu.org/licenses/gpl-3.0.txt
import random
from typing import Callable, List
from ums.agent import ExtractAudioAgent, ExtractImageAgent, ExtractTextAgent, SolveAgent, GatekeeperAgent
@ -59,14 +61,14 @@ class MySolveAgent(SolveAgent):
status.extract.required = False
self.sub_riddle(riddle=Riddle(context="Haha", question="Blubber"), status=status)
return RiddleSolution(solution="Huii", explanation="Blubb")
return RiddleSolution(solution="Huii", explanation=f"Blubb, {random.random()}")
class MyGatekeeperAgent(GatekeeperAgent):
def handle(self, solution: RiddleSolution, riddle: Riddle) -> RiddleSolution:
solution.accepted = True
solution.review = "Ok"
def handle(self, solution: List[RiddleSolution], riddle: Riddle) -> RiddleSolution:
solution[0].accepted = True
solution[0].review = "Ok"
return solution