-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hey @MB-Finski
I had a look at the code you wrote for this and am listing things that could be improved here as an overview :)
Backend
- I think it would be good to introduce PHP-Code-Sniffer, so that the repo uses the canonical Nextcloud coding style. The corresponding CI action is already installed, the only thing it now needs is a composer.json file containing the command and the dependency
- The CI workflows also contain a REUSE workflow that is currently failing. It would be good to fix the issues mentioned in the action run here
- The CI workflow for linting PHP is also failing because of a missing composer.json command (see https://github.com/nextcloud/integration_openai/blob/main/composer.json where you've done this already)
- Currently the github actions workflow folder also contains workflows for phpunit, which currently don't do anything. As long as no tests are implemented we can leave these out, I think: https://github.com/nextcloud/gptfreeprompt/blob/main/.github/workflows/phpunit-sqlite.yml
- The getTitle() method of the reference provider currently always returns the english title. Would be nice to translate that as in the comment https://github.com/nextcloud/gptfreeprompt/blob/main/lib/Reference/GptFreePromptReferenceProvider.php#L39
- To avoid confusion, I recommend not reusing QueryBuilder objects and creating new ones for each new query (e.g. here https://github.com/nextcloud/gptfreeprompt/blob/main/lib/Db/PromptMapper.php#L179 )
- PromptMapper#createPrompt: The way the mapper classes are usually used is to create the model object (ie.
Prompt) outside of the mapper class and then pass it to update/insert methods. You can then also update the timestamp by overriding the insert/update methods setting the new timestamp on the model and then calling parent::insert($prompt) https://github.com/nextcloud/gptfreeprompt/blob/main/lib/Db/PromptMapper.php#L115-L138 - In your PromptMapper you have a query that sorts by timestamp. It would then make sense to add an index for userId,timestamp to make sure this query performs well: https://github.com/nextcloud/gptfreeprompt/blob/main/lib/Migration/Version010000Date20230929162000.php#L51
- GptFreePromptService#processPrompt: you are calling runTask. This works well for e.g. openai providers but will fail with e.g. the llm app because it will take longer than the max execution time of php (usually 30-60s). I recommend using runOrSchedule (which hopefully makes it into 28) https://github.com/nextcloud/gptfreeprompt/blob/main/lib/Service/GptFreePromptService.php#L39
Frontend
- Currently the picker seems to only be displayed when the user is an admin? https://github.com/nextcloud/gptfreeprompt/blob/main/src/reference.js#L15
- The frontend looks really nice, though!
Other
- Usually we check in screenshots into the repository as well to have them be part of the licensing and allow people to collaborate on them https://github.com/nextcloud/gptfreeprompt/blob/main/appinfo/info.xml#L19C109-L19C112
Other than these the app looks already quite nice! Nice job!
Marcel
MB-Finski
Metadata
Metadata
Assignees
Labels
No labels