mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-06-27 16:10:30 +08:00
Merge pull request #419 from Vechtomov/generate-task-refactoring
Simplified random task generation
This commit is contained in:
@@ -24,14 +24,13 @@ def generate_task(
|
||||
match request.type:
|
||||
case protocol_schema.TaskRequestType.random:
|
||||
logger.info("Frontend requested a random task.")
|
||||
while request.type == protocol_schema.TaskRequestType.random:
|
||||
disabled_tasks = (
|
||||
protocol_schema.TaskRequestType.summarize_story,
|
||||
protocol_schema.TaskRequestType.rate_summary,
|
||||
)
|
||||
request.type = random.choice(
|
||||
tuple(set(protocol_schema.TaskRequestType).difference(disabled_tasks))
|
||||
).value
|
||||
disabled_tasks = (
|
||||
protocol_schema.TaskRequestType.random,
|
||||
protocol_schema.TaskRequestType.summarize_story,
|
||||
protocol_schema.TaskRequestType.rate_summary,
|
||||
)
|
||||
candidate_tasks = set(protocol_schema.TaskRequestType).difference(disabled_tasks)
|
||||
request.type = random.choice(tuple(candidate_tasks)).value
|
||||
return generate_task(request, pr)
|
||||
|
||||
# AKo: Summary tasks are currently disabled/supported, we focus on the conversation tasks.
|
||||
|
||||
Reference in New Issue
Block a user