-
Notifications
You must be signed in to change notification settings - Fork 18
feat: support multiple providers #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
0a16060 to
ec9f3f6
Compare
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
ec9f3f6 to
87aaffa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Could you describe more what the change actually is? It would make it easier to navigate in the diff.
- After switching to this branch and reloading the settings, i get
Is it expected?
- It is not clear what is specific to the selected context and what is global. It might help to group what is context-specific or add an indicator next to each of those fields.
- Maybe it's more explicit or easy to follow for the users if there are 4 "service" blocks: a global one, one for image gen, one for tts, one for stt. Each block would be placed in the related section.
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
|
julien-nc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need to clarify what is impacted by switching contexts. Either a visual clue of an explanation text in a note card.
We should mention that text generation is necessarily configured with the default context.
| } else { | ||
| $serviceName = $this->openAiSettingsService->getServiceName(); | ||
| if ($serviceType === 'image' && $this->openAiSettingsService->imageOverrideEnabled()) { | ||
| $serviceName = $this->openAiSettingsService->getImageServiceName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's an override (the override URL is defined) it does not mean the service name is defined. We should probably fall back to the default one. Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. It does fallback to LocalAI if a service name isn't defined and I think that is a better default than the service name of the text processing provider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok then let's change the fallback. Instead of LocalAI it could be something more generic like OpenAI/LocalAI integration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does detect OpenAI automatically, so OpenAI/LocalAI probably isn't the best name. I can't think of a better one though.
646c2e0 to
dba53a3
Compare
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
dba53a3 to
826cbbf
Compare
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
julien-nc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much better visually and logically 👍
Small change suggestion, otherwise let's go.
| } else { | ||
| $serviceName = $this->openAiSettingsService->getServiceName(); | ||
| if ($serviceType === 'image' && $this->openAiSettingsService->imageOverrideEnabled()) { | ||
| $serviceName = $this->openAiSettingsService->getImageServiceName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok then let's change the fallback. Instead of LocalAI it could be something more generic like OpenAI/LocalAI integration.
| if ($serviceType === Application::SERVICE_TYPE_IMAGE) { | ||
| $serviceUrl = $this->openAiSettingsService->getImageUrl(); | ||
| } elseif ($serviceType === Application::SERVICE_TYPE_STT) { | ||
| $serviceUrl = $this->openAiSettingsService->getSttUrl(); | ||
| } elseif ($serviceType === Application::SERVICE_TYPE_TTS) { | ||
| $serviceUrl = $this->openAiSettingsService->getTtsUrl(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe getImageServiceUrl would better explain the function, and so on for others
| if ($this->modelsMemoryCache !== null) { | ||
| $this->logger->debug('Getting OpenAI models from the memory cache'); | ||
| return $this->modelsMemoryCache; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this cache needs to be aligned with serviceType too, otherwise $serviceType = null's models are returned for every serviceType leading to an invalid list of models in the assistant modal if one of the services is overridden with non-intersecting models list
| if ($serviceType === Application::SERVICE_TYPE_IMAGE) { | ||
| $serviceUrl = $this->openAiSettingsService->getImageUrl(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's maybe check for each service type if the override service url is set/not empty and only then apply overrides
right now it feels like for any image request, we're setting all the override image settings first only to later discover the image's service url was empty and then re-set all the values
ah imageOverrideEnabled() is already added for this
|
|
||
| $timeout = $this->openAiSettingsService->getRequestTimeout(); | ||
| // Currently only supporting user api keys for the default service | ||
| if (empty($serviceUrl)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after the above change, this can be just else
| if ($this->isUsingOpenAi()) { | ||
| if ($this->isUsingOpenAi() || $this->openAiSettingsService->imageOverrideEnabled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's more likely that it would be available when it's been overridden but we can't be sure
same for others
| label: m.id | ||
| + (m.owned_by ? ' (' + m.owned_by + ')' : ''), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| label: m.id | |
| + (m.owned_by ? ' (' + m.owned_by + ')' : ''), | |
| label: m.id | |
| + (m.owned_by ? ' (' + m.owned_by + ')' : ''), |
| }, | ||
| async getAllModels(shouldSave = true) { | ||
| const models = this.getModels() // for text | ||
| console.error(this.models) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| console.error(this.models) | |
| console.debug(this.models) |
| }) | ||
| }, | ||
| async getAllModels(shouldSave = true) { | ||
| const models = this.getModels() // for text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some indication that models is a Promise would be nice
| || this.state.default_completion_model_id !== this.selectedModel.text.id | ||
| || this.state.default_image_model_id !== this.selectedModel.image.id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checks for stt and tts too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe some indication if a service is overridden would be cool, maybe a big blue dot or something beside the override button






Simple Overview

Adds hidden menus for override in the ui. When you select a different context you can specify settings for that context otherwise the default will be used.
Description