aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2023-07-07 11:42:19 +0200
committerMarcel Klehr <mklehr@gmx.net>2023-07-07 13:39:10 +0200
commit945522768e1e0df6684bb15d6dc5ef92d0cf6be6 (patch)
treedb58023ac630d398777955c9024c0192e13e041b /lib
parentd56286b8acb319e05eaa8b8a920c76e76da336cf (diff)
downloadnextcloud-server-945522768e1e0df6684bb15d6dc5ef92d0cf6be6.tar.gz
nextcloud-server-945522768e1e0df6684bb15d6dc5ef92d0cf6be6.zip
LLM OCP API: Simplify LanguageModelManager#canHandleTask
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/LanguageModel/LanguageModelManager.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/LanguageModel/LanguageModelManager.php b/lib/private/LanguageModel/LanguageModelManager.php
index 11154849c42..c6f1a172294 100644
--- a/lib/private/LanguageModel/LanguageModelManager.php
+++ b/lib/private/LanguageModel/LanguageModelManager.php
@@ -127,7 +127,12 @@ class LanguageModelManager implements ILanguageModelManager {
}
public function canHandleTask(ILanguageModelTask $task): bool {
- return count(array_filter($this->getAvailableTaskClasses(), fn ($class) => $task instanceof $class)) > 0;
+ foreach ($this->getAvailableTaskClasses() as $class) {
+ if ($task instanceof $class) {
+ return true;
+ }
+ }
+ return false;
}
/**