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

Auto generate the meaning title for the message use the AI #92

Closed
ahaapple opened this issue Oct 24, 2024 · 4 comments · Fixed by #101
Closed

Auto generate the meaning title for the message use the AI #92

ahaapple opened this issue Oct 24, 2024 · 4 comments · Fixed by #101
Assignees
Labels

Comments

@ahaapple
Copy link
Contributor

in the frontend/lib/tools/auto.ts

You can initiate a request to gpt-4o-mini to summarize user questions in parallel.

import { generateText } from 'ai';

const { text } = await generateText({
  model: yourModel,
  system:
    'You are a professional writer. ' +
    'You write simple, clear, and concise content.',
  prompt: `Summarize the following article in 3-5 sentences: ${article}`,
});

The summary title and answer can then be streamed back to the client

   await streamResponse({ sources: texts, title: title }, onStream);

Finally, when savingMessages, also pass in the AI ​​generated title

      await saveMessages(userId, messages, fullAnswer, texts, images, videos, fullRelated);
@ahaapple ahaapple added the good first issue Good for newcomers label Oct 24, 2024
Copy link
Contributor

Thank you for creating this issue! 🎉 We'll look into it as soon as possible. In the meantime, please make sure to provide all the necessary details and context. If you have any questions or additional information, feel free to add them here. Your contributions are highly appreciated! 😊

You can also check our CONTRIBUTING.md for guidelines on contributing to this project.

@krushnarout
Copy link
Contributor

Hi @ahaapple, Please assign me this issue. Thank you!

@ahaapple
Copy link
Contributor Author

@krushnarout Thank you

Copy link
Contributor

Hello @ahaapple! Your issue #92 has been closed. Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants