Skip to content

Commit

Permalink
feat: add warning when chatbot enabled without a root agent id
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Dec 20, 2023
1 parent 49f2941 commit 7862f42
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { setupRoutes } from './routes/index';
import { AssistantPluginSetup, AssistantPluginStart, MessageParser } from './types';
import { BasicInputOutputParser } from './parsers/basic_input_output_parser';
import { VisualizationCardParser } from './parsers/visualization_card_parser';
import { AgentIdNotFoundError } from './routes/chat_routes';

export class AssistantPlugin implements Plugin<AssistantPluginSetup, AssistantPluginStart> {
private readonly logger: Logger;
Expand All @@ -31,6 +32,15 @@ export class AssistantPlugin implements Plugin<AssistantPluginSetup, AssistantPl
.create<AssistantConfig>()
.pipe(first())
.toPromise();

/**
* Check if user enable the chat without specifying a root agent id.
* If so, gives a warning for guidance.
*/
if (config.chat.enabled && !config.chat.rootAgentId) {
this.logger.warn(AgentIdNotFoundError);
}

const router = core.http.createRouter();

core.http.registerRouteHandlerContext('assistant_plugin', () => {
Expand Down

0 comments on commit 7862f42

Please sign in to comment.