Coder Social home page Coder Social logo

reply2future / xextension-newsassistant Goto Github PK

View Code? Open in Web Editor NEW
41.0 4.0 7.0 52 KB

An extension to summarize the feeds of FreshRSS using GPT.

Home Page: https://github.com/FreshRSS/FreshRSS

License: The Unlicense

PHP 52.04% HTML 29.81% JavaScript 12.79% CSS 5.36%
freshrss freshrss-extension

xextension-newsassistant's Introduction

News Assistant

Using the ai api of OpenAI, Anthropic, Groq by Portkey-AI/gateway to summary the news.

Features

  • summary the same topic news cross over different rss feeds.
  • add the topic tag automatically
  • change the summary rss feed to read status
  • support a lot of ai api by Portkey-AI/gateway

Usage

There are two methods to use it. One is only for openai, and second supports a lot of ai api by gateway which is recommended because supporting those difference api is not the goal of this project.

OpenAI(Legacy method)

This method is only for openai as a previous version of this extension. You don't need to do anything after upgrading this extension if you are using openai before.

Get the token of OpenAI

  1. create your OpenAI account
  2. go to there to generate a new API key, and copy it.

Gateway(Recommend)

This method is using Portkey-AI/gateway to support a lot of ai api. But you need to deploy a service to achieve this.

Deploy

You could deploy to Cloudflare Workers or running docker container.

Setup the extension

output2.mp4
  1. click the navigation button to get the summary report of the news feed.
  2. open a side webview to show the summary report of the news feed.

xextension-newsassistant's People

Contributors

reply2future avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xextension-newsassistant's Issues

Resume title by default instead of content

Due to the limitations of the model I was not able to summarize the content, while the title works well, except the content is default and may cause problems for a new user.

No summary generated

i have everything setup correct and i can see the api is being used via openIA's portal but nothing is summarized

image
image

No output

image

image
As shown in the figure, there is no text output [I can run normally in another freshress]
Use a self built chatGPT model that is compatible with OpenAI. There is no log output in the large model

image

Normally, there should be such output. But there is no log output in this freshress
(This screenshot is another normal summary of freshress logs)

handle the curl error

goal

It will display nothing when there are some request error like SSL_ERROR_SYSCALL

gen.layout.title is not a valid key

[Tue, 12 Sep 2023 09:56:11 +0000] [error] --- Could not fetch available extension from GitHub
[Tue, 12 Sep 2023 09:56:12 +0000] [error] --- Could not fetch available extension from GitHub
[Tue, 12 Sep 2023 09:56:13 +0000] [error] --- Could not fetch available extension from GitHub
[Tue, 12 Sep 2023 09:56:14 +0000] [error] --- Could not fetch available extension from GitHub
[Tue, 12 Sep 2023 09:56:39 +0000] [debug] --- gen.layout.title is not a valid key
[Tue, 12 Sep 2023 09:56:39 +0000] [debug] --- gen.action.set_read is not a valid key
[Tue, 12 Sep 2023 09:58:35 +0000] [debug] --- gen.layout.title is not a valid key
[Tue, 12 Sep 2023 09:58:35 +0000] [debug] --- gen.action.set_read is not a valid key

image

Telegram bot notification

#20 (comment)

To implement scheduled summarization and subsequently push the summarized content to a Telegram bot. But it would be a little bit difference to the original workflow, which is:

  1. select the category feeds to summarize
  2. click the read button to change the status of feeds (this may be not easy to do with telegram bot)

no whitespace

problem

There are some message is a whitespace which would be transfer to empty string.

Ollama Support?

This is wonderful but I don't want to spend thousands of dollars a month to get the results from this stuff Ollama is probably more than enough.

format the result

goal

the summary of data should be formatted when it containers some line breaks.

Gemini AI support

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];

const rssContent = `${latestItem.title} ${latestItem.contentSnippet}`;

return rssContent;

} 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();

make the UI more friendly

goal

  • add the MaxTokens hins
  • add the Temperature hins
  • add the api ref links
  • add the help ref links

[Request to add feature]: Automatically refresh summary

image

Option 1: When I click this button, I can automatically summarize the remaining 5 pieces of information
Alternatively, option 2: Use scrolling to automatically and continuously update summary summaries [just like displaying new articles in Freshrss]

Cannot get this to work..any help is appreciated...

I tried many times. I put in my openai api key sk-proj-H2hWKyBlRKQ...... and have the extension enabled , version ...News Assistant (0.11.1). I notice in the web config, the drop down boxes don't have any options outside the 1 default, -- openai and gpt-3.5-turbo-16k-0613. When i click the news assistant button (which seems to be greyed out), it just gives me the page that shows...

The summary of Today
Read ← Go back

with no api data.

The log file stated it could not find the parameters in the config file. I looked at the main freshrss config files and found these entries

'extensions_enabled' =>
array (
'News Assistant' => true,
),
'openai_base_url' => 'https://api.openai.com',
'openai_api_key' => 'sk-proj-H2hWKyBl.......................................',
'provider' => 'openai',
'max_tokens' => 4096,
'temperature' => 0.7,
'limit' => 10.0,
'model' => 'gpt-3.5-turbo-16k-0613',
'prompt' => 'Summarize this as you are news editor, you should merge the similar topic.',
'field' => 'content',
);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.