-
Notifications
You must be signed in to change notification settings - Fork 14
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
the modules with controllers were modified to be dynamic #85
base: main
Are you sure you want to change the base?
Conversation
2339996
to
f1391ff
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.
Thank you so much, @arodriguezcb, for your contributions to the project! 🎉 I'm really excited about the new features. Please take a look at my comments and let me know if you have some questions. 🙌
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.
Due to changes in this file when I run npm run start:dev
command I receive error:
"The Nx Daemon is unsupported in WebAssembly environments. Some things may be slower than or not function as expected."
@@ -5,7 +5,7 @@ import { AgentsModule } from './agents/agents.module'; | |||
import { ChatSockets } from './chat.sockets'; | |||
|
|||
@Module({ | |||
imports: [AgentsModule, AssistantModule.forRoot(assistantConfig)], | |||
imports: [AgentsModule, AssistantModule.register(assistantConfig)], |
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 update the readme
file:
forRoot
->register
- new property in the configuration
@@ -13,10 +13,13 @@ export const assistantParams: AssistantCreateParams = { | |||
export const assistantConfig: AssistantConfigParams = { | |||
id: process.env['ASSISTANT_ID'] || '', | |||
params: assistantParams, | |||
assistantPrefix: 'assistant-prefix', |
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.
Can you put default assistant-prefix
as an "optional" value - empty string?
@@ -13,10 +13,13 @@ export const assistantParams: AssistantCreateParams = { | |||
export const assistantConfig: AssistantConfigParams = { | |||
id: process.env['ASSISTANT_ID'] || '', | |||
params: assistantParams, | |||
assistantPrefix: 'assistant-prefix', |
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.
import { AiService } from './ai.service'; | ||
import { AiController } from './ai.controller'; | ||
import { createControllerWithPrefix } from '../../utils/controllers'; | ||
|
||
@Module({ | ||
providers: [AiService], | ||
controllers: [AiController], |
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.
In that case we have multiple controllers, please remove it.
import { FilesService } from './files.service'; | ||
import { FilesController } from './files.controller'; | ||
import { AiModule } from '../ai'; | ||
import { createControllerWithPrefix } from '../../utils/controllers'; | ||
|
||
@Module({ | ||
imports: [AiModule], | ||
providers: [FilesService], | ||
controllers: [FilesController], |
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.
In that case we have multiple controllers, please remove it.
import { ThreadsController } from './threads.controller'; | ||
import { ThreadsService } from './threads.service'; | ||
import { AiModule } from '../ai'; | ||
import { createControllerWithPrefix } from '../../utils/controllers'; | ||
|
||
@Module({ | ||
imports: [AiModule], | ||
providers: [ThreadsService], | ||
controllers: [ThreadsController], |
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.
In that case we have multiple controllers, please remove it.
|
||
expect(originalPath).toBe('test'); | ||
|
||
expect(prefixedPath).toBe('api/test'); |
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 can't image the case that we would like to keep both version - with and without prefix. IMO user should be able to decide and select only one option by providing prefix or not.
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently, modules are loaded as singletons and with static paths, which makes it difficult to use multiple assistants configurations.
Issue Number: N/A
What is the new behavior?
Modules are created dynamically and a prefix is added to modify the paths of each loaded assitant.
Other information