Share Generation Class Between Saas And Self Hosted
Problem
With introduction of self-hosted models, we also added separate Task classes for completion/generation (CodeSuggestions::Tasks::SelfHostedCodeCompletion, CodeSuggestions::Tasks::SelfHostedCodeGeneration), IOW it adds self-hosted alternate class for each task so number of Task classes is doubled.
This is not ideal because:
- the original purpose of Task categorization is categorize requests by completion vs generation. Categorize them by self-hosted status is orthogonal to this original categorization and it is bit confusing in this class hierarchy
- it adds more complexity when it needs to be extended (as discussed in !157996 (comment 1978513324))
Proposal
Self-hosted classes are almost same as "default" task classes - these differ mainly in passing additional params. Perhaps we can just extract self-hosted logic in a mixin which is then included in completion/generation Task classes. Very rough snippet in !157996 (comment 1978976111)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Before | After |
|---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Related to #470536 (closed)