memfreeme / memfree

MemFree - Hybrid AI Search Engine & AI Page Generator
https://www.memfree.me
MIT License
1.06k stars 168 forks source link

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

Closed ahaapple closed 4 weeks ago

ahaapple commented 1 month ago

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);
github-actions[bot] commented 1 month ago

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 commented 1 month ago

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

ahaapple commented 1 month ago

@krushnarout Thank you

github-actions[bot] commented 4 weeks ago

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