Closed aligundogar closed 1 month ago
For your title of your question you could see that answer https://github.com/reply2future/xExtension-NewsAssistant/issues/25#issuecomment-2016533233
For your content you should to ask FreshRSS
repo for help. I think you didn't know how to get the rss content from FreshRSS
, if it like what I say, you could find the RSS content from URL like this https://test.com/i/?a=rss&rid=6638e7efdb0aa&hours=168
and you should change the domain and query params to your need.
No, I know hot to get feed from freshrss. I want to use it like your ex. I also asked to FreshRss repo. I just like to way your ex is working. Just wondered to use Gemini API like openai.
otherwise the code is already running on javascript. I can get what I want at this point just wanted to merge with the Newsassistant because gemini api is free atm.
This extension supports Portkey-AI/gateway so it could support a lot of LLM api because it unified API Signature as OpenAI, and it would solve https://github.com/reply2future/xExtension-NewsAssistant/issues/25 or to support other new AI API which is not the goal of this project.
https://github.com/Portkey-AI/gateway/?tab=readme-ov-file#use-it-while-making-your-request
Thank you.
Thinking of run it with FreshRSS, is there anyone to can help me?
const Parser = require('rss-parser'); const { GoogleGenerativeAI, HarmCategory, HarmBlockThreshold, } = require('@google/generative-ai');
const MODEL_NAME = 'gemini-1.5-pro-latest'; const API_KEY = 'XXX';
const parser = new Parser(); const feedURL = 'https://test.com/feed/';
async function getRSSData() { try { const feed = await parser.parseURL(feedURL); const latestItem = feed.items[0];
} catch (err) { console.error('RSS verisi alınamadı:', err); return null; } }
async function runChat() { const rssContent = await getRSSData();
if (!rssContent) { console.log('RSS verisi alınamadı.'); return; }
const genAI = new GoogleGenerativeAI(API_KEY); const model = genAI.getGenerativeModel({ model: MODEL_NAME });
const generationConfig = { temperature: 1, topK: 0, topP: 0.95, maxOutputTokens: 8192, };
const safetySettings = [ { category: HarmCategory.HARM_CATEGORY_HARASSMENT, threshold: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE, }, { category: HarmCategory.HARM_CATEGORY_HATE_SPEECH, threshold: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE, }, { category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, threshold: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE, }, { category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, threshold: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE, }, ];
const chat = model.startChat({ generationConfig, safetySettings, history: [], });
const result = await chat.sendMessage(rssContent);
const response = result.response; console.log(response.text()); }
runChat();