Skip to content

Conversation

edward-ly
Copy link

No description provided.

@welcome
Copy link

welcome bot commented May 15, 2025

Thanks for opening your first pull request in this repository! ✌️

@ChristophWurst
Copy link
Member

It was decided that we should move on with this without nextcloud/server#52852.

I'll look for a way to make Psalm understand the foreign code.

@edward-ly edward-ly force-pushed the feat/context-chat branch 2 times, most recently from 16633b0 to a359dd7 Compare June 18, 2025 23:46
@ChristophWurst
Copy link
Member

It was decided that we should move on with this without nextcloud/server#52852.

I'll look for a way to make Psalm understand the foreign code.

Since we have to do workarounds to get Psalm working with stubs, have a stub update mechanism, and additionally need the actual classes to be able to write tests, we decided that nextcloud/server#52852 should be pursued again. It's also an investment of time, but we'll have our standard setup for app communication through the OCP public API. That setup works for Psalm and PHPUnit.

@edward-ly edward-ly force-pushed the feat/context-chat branch 2 times, most recently from c2efb0b to 6a236d3 Compare July 9, 2025 22:04
@edward-ly edward-ly force-pushed the feat/context-chat branch 3 times, most recently from dd566f9 to a7bc7ba Compare July 15, 2025 23:43
@edward-ly edward-ly force-pushed the feat/context-chat branch 8 times, most recently from 52dcdfc to 9077fa6 Compare July 24, 2025 06:41
Copy link
Member

@marcelklehr marcelklehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good to me! If we can finish the tests, I'd look forward to a review from the groupware team 💙

@edward-ly
Copy link
Author

I don't have a working app_api/assistant/context_chat setup and can only make a guess, but it seems that once an administrator sets up context_chat on a Nextcloud instance, new emails are automatically fed into that model? If that's correct, then we should have a per-account toggle to turn that off.

I don't know if all of the existing apps have a similar toggle yet, but yeah, that's a good idea regardless. Where in the mail settings do you think would be a good place to put it?

@edward-ly edward-ly force-pushed the feat/context-chat branch 2 times, most recently from f87d978 to 6023995 Compare October 9, 2025 16:11
edward-ly and others added 16 commits October 14, 2025 09:17
- rename Job to Task to make it easier to differentiate it from bg jobs
- simplify db schema
- change contentItem id to include mailbox id
- move message filtering into DB queries
- add lots of error handling

Signed-off-by: Edward Ly <[email protected]>
@ChristophWurst
Copy link
Member

@edward-ly could you please add instructions for how to test this? I set up context_chat and assistant. I ran cron many times. The initial import is not triggered.

@edward-ly
Copy link
Author

@edward-ly could you please add instructions for how to test this? I set up context_chat and assistant. I ran cron many times. The initial import is not triggered.

Hm, the docs say that "the triggerInitialImport method is called when Context Chat is first set up", but it's not clear what "set up" means, for sure. Maybe context_chat needs to be installed after the mail app so that it can find and trigger all existing providers?

@marcelklehr do you know the specifics around this?

@marcelklehr
Copy link
Member

The import function should be called when the app registers itself with context chat for the first time, so it shouldn't matter which one is installed first.

@ChristophWurst Did you install context_chat_backend as well?

@marcelklehr
Copy link
Member

I currently cannot test this either, because (likely since this was rebased on main) the mail app in this branch cannot connect to any IMAP server. :/

@ChristophWurst
Copy link
Member

@ChristophWurst Did you install context_chat_backend as well?

Bingo! That one is missing

@ChristophWurst
Copy link
Member

Thanks to you and Alexander I have CCB running. I wasn't able to catch the initial import method with xdebug. Maybe it just hasn't run.

I see this in CB stats:

ContextChat statistics:
The indexing is not complete yet.
Total eligible files: 4
Files in indexing queue: 4
New files in indexing queue (without updates): 4
Queued documents (without files):array (
)
Files successfully sent to backend: 0
Indexed documents: array (
)
Actions in queue: 0
File system events in queue: 0

\OCA\ContextChat\BackgroundJobs\SubmitContentJob::run ran with a few email (most recent ones).

The import function should be called when the app registers itself with context chat for the first time

How can I trigger that?

@marcelklehr
Copy link
Member

mmh, this may be a bug in context_chat then 🤔

This method here should be called whenever an app interacts with context_chat: https://github.com/nextcloud/context_chat/blob/main/lib/Public/ContentManager.php#L95 and triggers an event for apps to register themselves.

@marcelklehr
Copy link
Member

Mmh, looking into this it might be a mind-o that we hadn't realized so far: https://github.com/nextcloud/context_chat/blob/main/lib/Event/ContentProviderRegisterEvent.php#L10

context_chat triggers its own event. The thinking was that making this even inherít from the event in OCP would make it compatible, but since the class path is different, any app listening to the OCP event will likely never get called.

@marcelklehr
Copy link
Member

This may be a fix, haven't tested yet: nextcloud/context_chat#187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 🏗️ In progress

Development

Successfully merging this pull request may close these issues.

5 participants