Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement summarize_story for web #64

Merged
merged 1 commit into from
Dec 26, 2022
Merged

Implement summarize_story for web #64

merged 1 commit into from
Dec 26, 2022

Conversation

AbdBarho
Copy link
Collaborator

@AbdBarho AbdBarho commented Dec 26, 2022

Partially closes #28

There is no corresponding endpoint for submission the backend, so the submission is left unimplemented.

Merry Christmas 🎄

Copy link
Collaborator

@fozziethebeat fozziethebeat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can, please make the two small requested changes, otherwise I'll make them in a follow up PR.

// signal somewhere that this interaction is being processed.
const submitResponse = (task: { id: string }) => {
const text = inputRef.current.value.trim();
// TODO: implement after we have the backend endpoint
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you uncomment and implement the mutation code here (mostly copied from website/src/pages/grading/grade-output.tsx) with a new field in the trigger body (that i'll make work in a following PR): update_type: "text_reply_to_post"

I can make this work pretty quick.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fozziethebeat gladly, quick question: post in the sense of HTTP POST, or post as in reddit post?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

post in text_reply_to_post refers to a row in the database in the post table. The post table allows to store conversation trees (threads or completions of different users or model sampling runs). The interactions like ratings and rankings are store in a separate table called post_reaction (currently users can only submit a single reaction to a given post).

@@ -0,0 +1,107 @@
import { Textarea } from "@chakra-ui/react";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment at the top here:

// TODO(#65): Unify and simplify the task paths.

@andreaskoepf
Copy link
Collaborator

There is no corresponding endpoint for submission the backend, so the submission is left unimplemented.

Merry X-Mas! :-) The endpoint to submit user generated summaries is the POST /api/v1/tasks/interaction endpoint, please see the text-frontend here and the discord-bot ApiClient and SummarizeStoryHandler.

@AbdBarho
Copy link
Collaborator Author

@andreaskoepf thank you, I think we already have a backend that calls the right api:

const interactionRes = await fetch(`${process.env.FASTAPI_URL}/api/v1/tasks/interaction`, {
method: "POST",
headers: {
"X-API-Key": process.env.FASTAPI_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
type: "post_rating",
user: {
id: token.sub,
display_name: token.name || token.email,
auth_method: "local",
},
post_id: id,
user_post_id: interaction.id,
...content,
}),
});

This was a bit unclear for me at the beginning with 2 backends, it is still unclear to me why it has to be like this, but for an MVP its ok.

Copy link
Collaborator

@yk yk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you very much :)

just briefly regarding the "two backends". The real backend is the fastapi backend. The nextjs project is technically considered a "frontend" (even though it consists of its own back- and frontend). Other frontends exist, such as the discord bot. Frontends are responsible for making the user interaction happen and then sending all information to the backend.

The architecture is like this so we don't have to re-implement a lot of logic in all the place, like the bot, the website, etc.

@fozziethebeat
Copy link
Collaborator

There's a small change in the trigger body that I'll make in a follow up PR.

@fozziethebeat fozziethebeat merged commit 68aa2d9 into LAION-AI:main Dec 26, 2022
@AbdBarho AbdBarho deleted the summarize branch December 27, 2022 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement summarize_story for web
4 participants