Skip to content

Commit

Permalink
[TASK] Add progress and change text
Browse files Browse the repository at this point in the history
  • Loading branch information
ayacoo committed May 28, 2023
1 parent f698fa8 commit bb6d3b7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Resources/Public/JavaScript/summarize.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import AjaxRequest from "@typo3/core/ajax/ajax-request.js"
import Notification from "@typo3/backend/notification.js";
import nprogress from "nprogress";

class Summarize {
constructor() {
Expand All @@ -23,6 +24,7 @@ class Summarize {
uid: newsId
}

nprogress.start();
new AjaxRequest(url)
.post(payload).then(async function (response) {
const data = await response.resolve();
Expand All @@ -46,12 +48,15 @@ class Summarize {
clearInterval(timer);
}
}, speed);
nprogress.done();
} else {
Notification.error(TYPO3.lang['tldr.alert.error'], data.text);
nprogress.done();
}

}, function (error) {
Notification.error(TYPO3.lang['tldr.alert.error'], error.response.status + ' ' + error.response.statusText);
nprogress.done();
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ayacoo/news-tldr",
"version": "1.0.0",
"version": "1.0.1",
"type": "typo3-cms-extension",
"description": "Creates a short summary for news via ChatGPT",
"homepage": "https://www.ayacoo.de",
Expand All @@ -15,7 +15,7 @@
],
"require": {
"php": ">=8.1",
"typo3/cms-core": "^12.3",
"typo3/cms-core": "^12.4",
"georgringer/news": "^11.0"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion ext_conf_template.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cat=Settings/O; type=string; label= ChatGPT Token
# cat=Settings/O; type=string; label= OpenAI Token
token =
# cat=Settings/O; type=string; label= ChatGPT Model
model = gpt-3.5-turbo
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
'author' => 'Guido Schmechel',
'author_email' => '[email protected]',
'author_company' => 'ayacoo',
'version' => '1.0.0',
'version' => '1.0.1',
];

0 comments on commit bb6d3b7

Please sign in to comment.