Frag das Portal durchsucht alles, neue Demo-Inhalte (0.66.0)
All checks were successful
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) Successful in 8m33s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 9m8s
CI / PHP 8.3 / mysql:8.4-1 (pull_request) Successful in 17m55s
CI / Build-Artefakte aktuell (pull_request) Successful in 9m50s
All checks were successful
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) Successful in 8m33s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 9m8s
CI / PHP 8.3 / mysql:8.4-1 (pull_request) Successful in 17m55s
CI / Build-Artefakte aktuell (pull_request) Successful in 9m50s
- Wissensquellen: Termine, Downloads, Formulare, Stellen, Ideen, Umfragen, Personen, eigene IT-Tickets/Geräte (OpenNIT, je Anfrage zwischengespeichert) - Ranking mit IDF, Abfrage je Begriff, Abkürzungen als ganze Wörter, LIKE unabhängig von Groß-/Kleinschreibung (JSON-Spalten), Datum im Prompt - Demo-Inhalte für einen Träger der Eingliederungshilfe (DemoData), mehrseitige PDFs, vorhandene Inhalte je Bereich entfernen Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1656cd8090
commit
3addc09c38
165 changed files with 2258 additions and 814 deletions
43
app/Ask/PeopleKnowledge.php
Normal file
43
app/Ask/PeopleKnowledge.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Ask;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Support\ProfileFields;
|
||||
|
||||
/**
|
||||
* Wissensquelle für „Frag das Portal“: das Personenverzeichnis – „Wer ist für die IT
|
||||
* zuständig?“, „Wie erreiche ich die Personalabteilung?“. Nur, was das Verzeichnis
|
||||
* ohnehin zeigt; eingeschränkte Profilfelder nur nach den Regeln des Profils.
|
||||
*/
|
||||
class PeopleKnowledge
|
||||
{
|
||||
public function __construct(private readonly ProfileFields $fields) {}
|
||||
|
||||
/**
|
||||
* @param list<string> $terms
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function __invoke(User $user, array $terms, int $limit): array
|
||||
{
|
||||
$query = User::query()->active();
|
||||
Knowledge::whereAny($query, ['first_name', 'last_name', 'job_title', 'department', 'location', 'about'], $terms);
|
||||
|
||||
return $query->orderBy('last_name')->limit($limit)->get()->map(function (User $person) use ($user) {
|
||||
$extra = collect($this->fields->visibleValues($person, $user))->map(fn (array $f) => $f['label'].': '.$f['value'])->implode('. ');
|
||||
|
||||
return [
|
||||
'title' => $person->name.($person->job_title ? ' – '.$person->job_title : ''),
|
||||
'url' => route('people.show', $person),
|
||||
'text' => implode(' ', array_filter([
|
||||
$person->name.' arbeitet'.($person->job_title ? ' als '.$person->job_title : '').($person->department ? ' im Bereich '.$person->department : '').($person->location ? ', Standort '.$person->location : '').'.',
|
||||
$person->phone ? 'Telefon: '.$person->phone.'.' : null,
|
||||
$person->mobile ? 'Mobil: '.$person->mobile.'.' : null,
|
||||
'E-Mail: '.$person->email.'.',
|
||||
$extra ? $extra.'.' : null,
|
||||
]))."\n".(string) $person->about,
|
||||
'meta' => collect([$person->department, $person->location])->filter()->implode(', ') ?: null,
|
||||
];
|
||||
})->all();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue