Skip to content

Commit

Permalink
feat: Integrate interchain agent bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Hemanthghs committed Sep 19, 2024
1 parent 25f4701 commit 26db9b5
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"axios": "^1.5.1",
"chain-registry": "1.28.1",
"chart.js": "^4.4.1",
"chat-agent-widget": "1.0.1",
"cosmjs-types": "^0.9.0",
"date-fns": "2.30.0",
"eslint": "8.50.0",
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/components/main-layout/FixedLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import { TxStatus } from '@/types/enums';
import useGetShowAuthzAlert from '@/custom-hooks/useGetShowAuthzAlert';
import { initializeGA } from '@/utils/util';
import { NotSupportedMetamaskChainIds } from '@/utils/constants';
import ChatWidget from 'chat-agent-widget';
import { ARKA_BOT_CONFIG } from '@/constants/arka-bot';

declare let window: WalletWindow;

Expand Down Expand Up @@ -147,6 +149,19 @@ const FixedLayout = ({ children }: { children: React.ReactNode }) => {
) : (
<DynamicSection>{children}</DynamicSection>
)}
{ARKA_BOT_CONFIG.accessToken.length &&
ARKA_BOT_CONFIG.refreshToken.length ? (
<ChatWidget
accessToken={ARKA_BOT_CONFIG.accessToken}
apiUrl={ARKA_BOT_CONFIG.apiUrl}
deploymentID={Number(ARKA_BOT_CONFIG.deploymentID)}
planID={Number(ARKA_BOT_CONFIG.planID)}
planOwner={ARKA_BOT_CONFIG.planOwner}
refreshToken={ARKA_BOT_CONFIG.refreshToken}
subscriber={ARKA_BOT_CONFIG.subscriber}
theme={ARKA_BOT_CONFIG.theme}
/>
) : null}
</section>
<footer>
<Footer />
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/constants/arka-bot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const ARKA_BOT_THEME = {
title: 'Interchain Agent',
primaryColor: '#40404a',
bubbleText: 'Ask',
bubbleColor: '#40404a',
};
export const ARKA_BOT_CONFIG = {
apiUrl: process.env.NEXT_PUBLIC_BOT_API_URL || '',
accessToken: process.env.NEXT_PUBLIC_BOT_ACCESS_TOKEN || '',
refreshToken: process.env.NEXT_PUBLIC_BOT_REFRESH_TOKEN || '',
deploymentID: process.env.NEXT_PUBLIC_BOT_DEPLOYMENT_ID || '',
planID: process.env.NEXT_PUBLIC_BOT_PLAN_ID || '',
planOwner: process.env.NEXT_PUBLIC_BOT_PLAN_OWNER || '',
subscriber: process.env.NEXT_PUBLIC_BOT_SUBSCRIBER || '',
theme: ARKA_BOT_THEME || {},
};
36 changes: 33 additions & 3 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2699,6 +2699,11 @@ chart.js@^4.4.1:
dependencies:
"@kurkle/color" "^0.3.0"

[email protected]:
version "1.0.1"
resolved "https://registry.yarnpkg.com/chat-agent-widget/-/chat-agent-widget-1.0.1.tgz#6adc525de3e32211cb054e27b91585e4d3dccf70"
integrity sha512-gqoAv/kkn44vwhZa06xNun3jqnEc8/etuysQbFCCIDb6s04gmpjQvMii/SVzxQogdlLcDMjb6G9TtI86QpHiAA==

chokidar@^3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd"
Expand Down Expand Up @@ -5717,7 +5722,16 @@ streamsearch@^1.1.0:
resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764"
integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==

"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -5796,7 +5810,14 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -6349,7 +6370,16 @@ word@~0.3.0:
resolved "https://registry.yarnpkg.com/word/-/word-0.3.0.tgz#8542157e4f8e849f4a363a288992d47612db9961"
integrity sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down

0 comments on commit 26db9b5

Please sign in to comment.