Skip to content
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

[Feature] Add rootAgentId config in dashboard yml file #78

Merged
merged 7 commits into from
Dec 21, 2023

Conversation

SuZhou-Joe
Copy link
Member

@SuZhou-Joe SuZhou-Joe commented Dec 18, 2023

Description

For 2.12, we will store the root agent id into opensearch_dashboards.yml file and only cluster admin will be able to modify that.

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@SuZhou-Joe SuZhou-Joe force-pushed the feature/root_agent_id branch from 124aedc to 3278ec2 Compare December 18, 2023 09:35
Signed-off-by: SuZhou-Joe <[email protected]>
Copy link

codecov bot commented Dec 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (66292ce) 83.52% compared to head (7862f42) 89.15%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #78      +/-   ##
==========================================
+ Coverage   83.52%   89.15%   +5.62%     
==========================================
  Files          43       43              
  Lines        1026     1033       +7     
  Branches      239      241       +2     
==========================================
+ Hits          857      921      +64     
+ Misses        168      111      -57     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: SuZhou-Joe <[email protected]>
@@ -142,7 +143,11 @@ export function registerChatRoutes(router: IRouter, routeOptions: RoutesOptions)
request,
response
): Promise<IOpenSearchDashboardsResponse<HttpResponsePayload | ResponseError>> => {
const { messages = [], input, sessionId: sessionIdInRequestBody, rootAgentId } = request.body;
if (!routeOptions.rootAgentId) {
context.assistant_plugin.logger.error(AgentIdNotFoundError);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about add similar warning message when OSD startup if chat is enabled and rootAgentId not configured?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, sounds reasonable.

@wanglam wanglam mentioned this pull request Dec 20, 2023
6 tasks
Copy link
Member

@joshuali925 joshuali925 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i remember the plan for getting agent_id was to search for the agent first, then fallback to config yaml if there are multiple or no match. Will that be a separate PR or did that plan change?

@@ -74,7 +75,7 @@ export class AssistantPlugin
const checkAccess = (account: Awaited<ReturnType<typeof getAccount>>) =>
account.data.roles.some((role) => ['all_access', 'assistant_user'].includes(role));

if (this.config.chat.enabled) {
if (this.config.chat.enabled && this.config.chat.rootAgentId) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we still want to show chat UI since it will receive AgentIdNotFoundError as response

if (!routeOptions.rootAgentId) {
context.assistant_plugin.logger.error(AgentIdNotFoundError);
return response.custom({ statusCode: 400, body: AgentIdNotFoundError });
}

to let web users know why chat is not available?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but the final solution has changed and no matter how we are gonna to remove the rootAgentId in request payload. Will optimize this part in another PR.

@SuZhou-Joe SuZhou-Joe merged commit a474220 into opensearch-project:main Dec 21, 2023
10 checks passed
@kavilla
Copy link
Member

kavilla commented Dec 21, 2023

Is there a default root agent id? or could we update the dev docs to get this root agent id?

@SuZhou-Joe
Copy link
Member Author

Is there a default root agent id? or could we update the dev docs to get this root agent id?

There is not a default root agent id, and there will be a doc in flow plugin to instruct how to setup a root agent id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants