Frag das Portal (0.64.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Has been skipped
CI / PHP 8.4 / mariadb:10.6 (pull_request) Has been skipped
CI / PHP 8.3 / mariadb:11.4 (pull_request) Has been skipped
CI / PHP 8.4 / mariadb:11.4 (pull_request) Has been skipped
CI / PHP 8.3 / mysql:8.0 (pull_request) Has been skipped
CI / PHP 8.4 / mysql:8.0 (pull_request) Has been skipped
CI / PHP 8.3 / mysql:8.4 (pull_request) Has been skipped
CI / PHP 8.4 / mysql:8.4 (pull_request) Has been skipped
CI / Browser-Tests (pull_request) Failing after 19m38s
CI / PHP 8.3 / mysql:8.4-1 (pull_request) Successful in 24m17s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 9m13s
CI / Build-Artefakte aktuell (pull_request) Successful in 6m4s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Has been skipped
CI / PHP 8.4 / mariadb:10.6 (pull_request) Has been skipped
CI / PHP 8.3 / mariadb:11.4 (pull_request) Has been skipped
CI / PHP 8.4 / mariadb:11.4 (pull_request) Has been skipped
CI / PHP 8.3 / mysql:8.0 (pull_request) Has been skipped
CI / PHP 8.4 / mysql:8.0 (pull_request) Has been skipped
CI / PHP 8.3 / mysql:8.4 (pull_request) Has been skipped
CI / PHP 8.4 / mysql:8.4 (pull_request) Has been skipped
CI / Browser-Tests (pull_request) Failing after 19m38s
CI / PHP 8.3 / mysql:8.4-1 (pull_request) Successful in 24m17s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 9m13s
CI / Build-Artefakte aktuell (pull_request) Successful in 6m4s
Antworten mit Quellen aus Seiten, QM-Dokumenten, Glossar und Neuigkeiten – nur aus Sichtbarem, über den KI-Assistenten (Anthropic, OpenAI, Ollama). Wissensquellen als Registry für Plugins, Auswertung ohne Personenbezug. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
372f0656f9
commit
9d8bdc08ce
168 changed files with 1751 additions and 383 deletions
33
plugins-core/news/src/NewsKnowledge.php
Normal file
33
plugins-core/news/src/NewsKnowledge.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Inhaus\Plugins\News;
|
||||
|
||||
use App\Ask\Knowledge;
|
||||
use App\Models\User;
|
||||
use App\Pagebuilder\Content;
|
||||
use Inhaus\Plugins\News\Models\NewsPost;
|
||||
|
||||
/** Wissensquelle für „Frag das Portal“: veröffentlichte Neuigkeiten, die die Person sieht */
|
||||
class NewsKnowledge
|
||||
{
|
||||
public function __construct(private readonly Content $content) {}
|
||||
|
||||
/**
|
||||
* @param list<string> $terms
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function __invoke(User $user, array $terms, int $limit): array
|
||||
{
|
||||
// Inhalt aus dem Baukasten liegt als JSON vor (Umlaute als ü) – auch diese Schreibweise suchen
|
||||
$encoded = array_map(fn (string $t) => trim((string) json_encode($t), '"'), $terms);
|
||||
$query = NewsPost::query()->published()->visibleTo($user)->with('category');
|
||||
Knowledge::whereAny($query, ['title', 'teaser', 'body', 'content'], array_values(array_unique([...$terms, ...$encoded])));
|
||||
|
||||
return $query->latest('published_at')->limit($limit)->get()->map(fn (NewsPost $post) => [
|
||||
'title' => $post->title,
|
||||
'url' => route('news.show', $post->slug),
|
||||
'text' => trim($post->teaser."\n".$this->content->plainText($this->content->render($post->blocks(), $user, ['news_id' => $post->id]))),
|
||||
'meta' => collect([$post->category?->name, $post->published_at?->translatedFormat('j. F Y')])->filter()->implode(', '),
|
||||
])->all();
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Inhaus\Plugins\News;
|
||||
|
||||
use App\Accessibility\EasyLanguage;
|
||||
use App\Ask\Knowledge;
|
||||
use App\Dashboard\Widgets;
|
||||
use App\Digest\Digest;
|
||||
use App\Editorial\Editorial;
|
||||
|
|
@ -61,6 +62,7 @@ class NewsPlugin extends Plugin
|
|||
])->all());
|
||||
|
||||
$this->app->make(GlobalSearch::class)->add('news', 'Neuigkeiten', 'newspaper', fn (...$args) => app(NewsSearch::class)(...$args), sort: 10);
|
||||
$this->app->make(Knowledge::class)->add('news', 'Neuigkeiten', fn (...$args) => app(NewsKnowledge::class)(...$args));
|
||||
|
||||
$this->app->make(Navigation::class)->add('news', 'Neuigkeiten', '/neuigkeiten', active: ['news.index', 'news.show'], sort: 20, icon: 'newspaper');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue