Merge branch 'main' of github.com:LAION-AI/Open-Chat-GPT into main

This commit is contained in:
Andreas Köpf
2022-12-16 18:21:55 +01:00
3 changed files with 4 additions and 20 deletions
+3 -14
View File
@@ -121,8 +121,6 @@ def generate_task(request: protocol_schema.TaskRequest) -> protocol_schema.Task:
)
logger.info(f"Generated {task=}.")
if request.user is not None:
task.addressed_user = request.user
return task
@@ -229,10 +227,7 @@ def post_interaction(
# ToDo: role user or agent?
pr.store_text_reply(interaction, role="unknown")
return protocol_schema.TaskDone(
reply_to_post_id=interaction.user_post_id,
addressed_user=interaction.user,
)
return protocol_schema.TaskDone()
case protocol_schema.PostRating:
logger.info(
f"Frontend reports rating of {interaction.post_id=} with {interaction.rating=} by {interaction.user=}."
@@ -241,10 +236,7 @@ def post_interaction(
# here we store the rating in the database
pr.store_rating(interaction)
return protocol_schema.TaskDone(
reply_to_post_id=interaction.post_id,
addressed_user=interaction.user,
)
return protocol_schema.TaskDone()
case protocol_schema.PostRanking:
logger.info(
f"Frontend reports ranking of {interaction.post_id=} with {interaction.ranking=} by {interaction.user=}."
@@ -253,10 +245,7 @@ def post_interaction(
# TODO: check if the ranking is valid
pr.store_ranking(interaction)
# here we would store the ranking in the database
return protocol_schema.TaskDone(
reply_to_post_id=interaction.post_id,
addressed_user=interaction.user,
)
return protocol_schema.TaskDone()
case _:
raise HTTPException(
status_code=HTTP_400_BAD_REQUEST,
-2
View File
@@ -62,7 +62,6 @@ class Task(BaseModel):
id: UUID = pydantic.Field(default_factory=uuid4)
type: str
addressed_user: Optional[User] = None
class SummarizeStoryTask(Task):
@@ -151,7 +150,6 @@ class TaskDone(Task):
"""Signals to the frontend that the task is done."""
type: Literal["task_done"] = "task_done"
reply_to_post_id: str
AnyTask = Union[
+1 -4
View File
@@ -205,10 +205,7 @@ def main(backend_url: str, api_key: str):
tasks.append(new_task)
case "task_done":
if addressed_user := task["addressed_user"]:
typer.echo(f"Hey, {addressed_user['display_name']}! Thank you!")
else:
typer.echo("Task done!")
typer.echo("Task done!")
case _:
typer.echo(f"Unknown task type {task['type']}")