diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml
index d1f42a7..3e5ac8a 100644
--- a/.github/workflows/integration-test.yml
+++ b/.github/workflows/integration-test.yml
@@ -23,7 +23,7 @@ concurrency:
jobs:
scan-test:
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-24.04
strategy:
# do not stop on another job's failure
@@ -223,6 +223,9 @@ jobs:
run: |
cd context_chat_backend
pip install --upgrade pip setuptools wheel
+ # use the cpu version of torch to not run out of space
+ pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
+ sed -i '/torch(vision)?/d' requirements.txt
pip install -r requirements.txt
cp example.env .env
echo "NEXTCLOUD_URL=http://localhost:8080" >> .env
@@ -338,7 +341,7 @@ jobs:
tail -v -n +1 context_chat_backend/persistent_storage/logs/* || echo "No logs in logs directory"
cron-test:
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-24.04
strategy:
# do not stop on another job's failure
@@ -482,6 +485,9 @@ jobs:
run: |
cd context_chat_backend
pip install --upgrade pip setuptools wheel
+ # use the cpu version of torch to not run out of space
+ pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
+ sed -i '/torch(vision)?/d' requirements.txt
pip install -r requirements.txt
cp example.env .env
echo "NEXTCLOUD_URL=http://localhost:8080" >> .env
@@ -643,7 +649,7 @@ jobs:
tail -v -n +1 context_chat_backend/persistent_storage/logs/* || echo "No logs in logs directory"
listener-test:
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-24.04
strategy:
# do not stop on another job's failure
@@ -791,6 +797,9 @@ jobs:
run: |
cd context_chat_backend
pip install --upgrade pip setuptools wheel
+ # use the cpu version of torch to not run out of space
+ pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
+ sed -i '/torch(vision)?/d' requirements.txt
pip install -r requirements.txt
cp example.env .env
echo "NEXTCLOUD_URL=http://localhost:8080" >> .env
diff --git a/lib/Service/MetadataService.php b/lib/Service/MetadataService.php
index 5c0dadd..fb52786 100644
--- a/lib/Service/MetadataService.php
+++ b/lib/Service/MetadataService.php
@@ -7,6 +7,7 @@
namespace OCA\ContextChat\Service;
+use OC\Files\SetupManager;
use OCA\ContextChat\Logger;
use OCA\ContextChat\Public\ContentManager;
use OCA\ContextChat\Public\IContentProvider;
@@ -166,14 +167,34 @@ public function getEnrichedSources(string $userId, string ...$sources): array {
}
}
- # for files
- foreach ($sources as $source) {
- if (!str_starts_with($source, ProviderConfigService::getDefaultProviderKey() . ': ')) {
- continue;
- }
- $enrichedSources[] = $this->getMetadataObjectForId($userId, $source);
+ $setupManager = \OCP\Server::get(SetupManager::class);
+ $user = $this->userManager->get($userId);
+
+ if ($user === null) {
+ $this->logger->warning('User not found for enriching sources', ['userId' => $userId]);
+ return $enrichedSources;
}
- return $enrichedSources;
+ try {
+ $setupManager->setupForUser($user);
+ } catch (\Throwable $e) {
+ $this->logger->error('Error setting up filesystem for user ' . $userId . ': ' . $e->getMessage(), ['exception' => $e]);
+ return $enrichedSources;
+ }
+
+ try {
+ # for files
+ foreach ($sources as $source) {
+ if (!str_starts_with($source, ProviderConfigService::getDefaultProviderKey() . ': ')) {
+ continue;
+ }
+ $enrichedSources[] = $this->getMetadataObjectForId($userId, $source);
+ }
+ } catch (\Throwable $e) {
+ $this->logger->error('Error enriching file sources: ' . $e->getMessage(), ['exception' => $e]);
+ } finally {
+ $setupManager->tearDown();
+ return $enrichedSources;
+ }
}
}
diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml
index 5e64b85..2e90ec5 100644
--- a/tests/psalm-baseline.xml
+++ b/tests/psalm-baseline.xml
@@ -34,4 +34,11 @@
+
+
+
+
+
+
+