Skip to content

Commit

Permalink
Format summarized content
Browse files Browse the repository at this point in the history
- Updated dependencies
  • Loading branch information
mithandir committed Nov 15, 2024
1 parent 89ec20d commit 59b5135
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"license": "UNLICENSED",
"dependencies": {
"@polymer/polymer": "3.5.2",
"@vaadin/bundles": "24.5.1",
"@vaadin/bundles": "24.5.3",
"@vaadin/common-frontend": "0.0.19",
"@vaadin/polymer-legacy-adapter": "24.5.1",
"@vaadin/react-components": "24.5.1",
"@vaadin/react-components-pro": "24.5.1",
"@vaadin/polymer-legacy-adapter": "24.5.3",
"@vaadin/react-components": "24.5.3",
"@vaadin/react-components-pro": "24.5.3",
"@vaadin/router": "2.0.0",
"@vaadin/vaadin-development-mode-detector": "2.0.7",
"@vaadin/vaadin-lumo-styles": "24.5.1",
"@vaadin/vaadin-material-styles": "24.5.1",
"@vaadin/vaadin-themable-mixin": "24.5.1",
"@vaadin/vaadin-lumo-styles": "24.5.3",
"@vaadin/vaadin-material-styles": "24.5.3",
"@vaadin/vaadin-themable-mixin": "24.5.3",
"@vaadin/vaadin-usage-statistics": "2.1.3",
"construct-style-sheets-polyfill": "3.1.0",
"date-fns": "2.29.3",
Expand Down Expand Up @@ -40,22 +40,22 @@
"vite": "5.4.9",
"vite-plugin-checker": "0.8.0",
"workbox-build": "7.1.1",
"workbox-core": "7.1.0",
"workbox-precaching": "7.1.0"
"workbox-core": "7.3.0",
"workbox-precaching": "7.3.0"
},
"vaadin": {
"dependencies": {
"@polymer/polymer": "3.5.2",
"@vaadin/bundles": "24.5.1",
"@vaadin/bundles": "24.5.3",
"@vaadin/common-frontend": "0.0.19",
"@vaadin/polymer-legacy-adapter": "24.5.1",
"@vaadin/react-components": "24.5.1",
"@vaadin/react-components-pro": "24.5.1",
"@vaadin/polymer-legacy-adapter": "24.5.3",
"@vaadin/react-components": "24.5.3",
"@vaadin/react-components-pro": "24.5.3",
"@vaadin/router": "2.0.0",
"@vaadin/vaadin-development-mode-detector": "2.0.7",
"@vaadin/vaadin-lumo-styles": "24.5.1",
"@vaadin/vaadin-material-styles": "24.5.1",
"@vaadin/vaadin-themable-mixin": "24.5.1",
"@vaadin/vaadin-lumo-styles": "24.5.3",
"@vaadin/vaadin-material-styles": "24.5.3",
"@vaadin/vaadin-themable-mixin": "24.5.3",
"@vaadin/vaadin-usage-statistics": "2.1.3",
"construct-style-sheets-polyfill": "3.1.0",
"date-fns": "2.29.3",
Expand Down Expand Up @@ -83,10 +83,10 @@
"vite": "5.4.9",
"vite-plugin-checker": "0.8.0",
"workbox-build": "7.1.1",
"workbox-core": "7.1.0",
"workbox-precaching": "7.1.0"
"workbox-core": "7.3.0",
"workbox-precaching": "7.3.0"
},
"hash": "d46a19ed6c007d00e0136a97e2f3e40f39c49e44a8304d8ca834a88848d2d5c7"
"hash": "16d27362325cb02d9c7d840288637ef2dc599169d9484a3c28f7d6f7abf5592c"
},
"overrides": {
"@vaadin/bundles": "$@vaadin/bundles",
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<properties>
<java.version>23</java.version>
<spring-ai.version>1.0.0-M3</spring-ai.version>
<vaadin.version>24.5.2</vaadin.version>
<maven.versions.plugin>2.17.1</maven.versions.plugin>
<vaadin.version>24.5.4</vaadin.version>
<maven.versions.plugin>2.18.0</maven.versions.plugin>
<rome.rss.version>2.1.0</rome.rss.version>
<browserstorage.version>1.0.0</browserstorage.version>
<jpushover.version>7.2.5</jpushover.version>
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/ch/climbd/newsfeed/controller/MlController.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,18 @@ public void summarize() {

private void summarizeNormalText(NewsEntry news) {
if (!news.getLink().startsWith("https://www.youtube.com/watch?v=")) {
news.setSummary(chatClient.prompt()
var content = chatClient.prompt()
.system("As a professional summarizer, create a concise and comprehensive summary of the provided text, be it an article, post, conversation, or passage, while adhering to these guidelines:\n" +
"* Craft a summary that is detailed, thorough, in-depth, and complex, while maintaining clarity and conciseness.\n" +
"* Rely strictly on the provided text, without including external information.\n" +
"* Format the summary in paragraph form for easy understanding.")
.user("Summaries the following:\n" + news.getContent())
.call()
.content());
LOG.debug("Summary: {}", news.getSummary());
.content();

content = content.replaceAll("\n", "<br><br>");
news.setSummary(content);
LOG.debug("Summary: {}", content);
mongo.update(news);
LOG.info("Summarized the article: {}", news.getTitle());
}
Expand Down

0 comments on commit 59b5135

Please sign in to comment.