Repository navigation
[Customer Portal][BE] Add AI chat agent for case classification during creation #126
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
Merged
Rashmika998
merged 8 commits into
wso2-open-operations:customer-portal-milestone-1
from
Rashmika998:customer-portal-milestone-1-chat
Feb 11, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
07422d5
Add AI chat agent
Rashmika998 20ef037
format config.toml.local
Rashmika998 d576472
Update documentation
Rashmika998 7bdb09f
Update config.toml.local
Rashmika998 8a00846
pdate reource name
Rashmika998 b652817
Updae documentation
Rashmika998 28844d8
Merge branch 'customer-portal-milestone-1' into customer-portal-miles…
Rashmika998 1367e63
Merge branch 'customer-portal-milestone-1' into customer-portal-miles…
shayanmalinda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
apps/customer-portal/backend/modules/ai_chat_agent/ai_chat_agent.bal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com). | ||
| // | ||
| // WSO2 LLC. licenses this file to you under the Apache License, | ||
| // Version 2.0 (the "License"); you may not use this file except | ||
| // in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| # Create case classification for the given payload. | ||
| # | ||
| # + payload - Case classification payload | ||
| # + return - Case classification response or error | ||
| public isolated function createCaseClassification(CaseClassificationPayload payload) | ||
| returns CaseClassificationResponse|error { | ||
|
|
||
| return aiChatAgentClient->/case_classification.post(payload); | ||
| } |
37 changes: 37 additions & 0 deletions
37
apps/customer-portal/backend/modules/ai_chat_agent/client.bal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com). | ||
| // | ||
| // WSO2 LLC. licenses this file to you under the Apache License, | ||
| // Version 2.0 (the "License"); you may not use this file except | ||
| // in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| import ballerina/http; | ||
|
|
||
| configurable string aiChatAgentBaseUrl = ?; | ||
| configurable ClientCredentialsOauth2Config clientCredentialsOauth2Config = ?; | ||
|
|
||
| final http:Client aiChatAgentClient = check new (aiChatAgentBaseUrl, { | ||
| auth: { | ||
| ...clientCredentialsOauth2Config | ||
| }, | ||
| httpVersion: http:HTTP_1_1, | ||
| http1Settings: {keepAlive: http:KEEPALIVE_NEVER}, | ||
| timeout: 300.0, | ||
| retryConfig: { | ||
| count: 3, | ||
| interval: 2.0, | ||
| statusCodes: [ | ||
| http:STATUS_BAD_GATEWAY, | ||
| http:STATUS_SERVICE_UNAVAILABLE, | ||
| http:STATUS_GATEWAY_TIMEOUT | ||
| ] | ||
| } | ||
| }); |
73 changes: 73 additions & 0 deletions
73
apps/customer-portal/backend/modules/ai_chat_agent/types.bal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| // Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com). | ||
| // | ||
| // WSO2 LLC. licenses this file to you under the Apache License, | ||
| // Version 2.0 (the "License"); you may not use this file except | ||
| // in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| import ballerina/data.jsondata; | ||
|
|
||
| # [Configurable] Client credentials grant type oauth2 configuration. | ||
| type ClientCredentialsOauth2Config record {| | ||
| # OAuth2 token endpoint | ||
| string tokenUrl; | ||
| # OAuth2 client ID | ||
| string clientId; | ||
| # OAuth2 client secret | ||
| string clientSecret; | ||
| # OAuth2 scopes | ||
| string[] scopes = []; | ||
| |}; | ||
|
|
||
| # Case classification payload. | ||
| public type CaseClassificationPayload record {| | ||
| # Chat history | ||
| string chat_history; | ||
| # Product details | ||
| string[] productDetails; | ||
| # Environments | ||
| string[] environments; | ||
| # Region | ||
| string region; | ||
| # Tier | ||
| string tier; | ||
| |}; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| # Case classification response. | ||
| public type CaseClassificationResponse record {| | ||
| # Issue type | ||
| string issueType; | ||
| # Case information | ||
| @jsondata:Name {value: "case_info"} | ||
| ChatCaseInfo caseInfo; | ||
| # Severity level | ||
| string severityLevel; | ||
| json...; | ||
| |}; | ||
|
|
||
| # Chat case information. | ||
| public type ChatCaseInfo record {| | ||
| # Description | ||
| string description; | ||
| # Short description | ||
| string shortDescription; | ||
| # Product name | ||
| string productName; | ||
| # Product version | ||
| string productVersion; | ||
| # Environment | ||
| string environment; | ||
| # Tier | ||
| string tier; | ||
| # Region | ||
| string region; | ||
| json...; | ||
| |}; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.