11import { OramaChatBox , OramaSearchBox , OramaSearchButton } from '@orama/react-components'
22import './App.css'
3-
43import { BrowserRouter , Routes , Route , NavLink , Navigate } from 'react-router'
4+ import { CollectionManager } from '@orama/core'
5+
6+ const ORAMACORE_ENDPOINT = 'https://oramacore.orama.foo'
7+ const ORAMACORE_COLLECTION_ID = 'cxlenmho72jp3qpbdphbmfdn'
8+ const ORAMACORE_READ_API_KEY = 'caTS1G81uC8uBoWICSQYzmGjGVBCqxrf'
9+
10+ // Create a CollectionManager instance
11+ const collectionManager = new CollectionManager ( {
12+ url : ORAMACORE_ENDPOINT ,
13+ collectionID : ORAMACORE_COLLECTION_ID ,
14+ readAPIKey : ORAMACORE_READ_API_KEY ,
15+ } )
516
6- const API_KEY = 'LerNlbp6379jVKaPs4wt2nZT4MJZbU1J'
7- const ENDPOINT = 'https://cloud.orama.run/v1/indexes/docs-orama-b3f5xd'
817
918function App ( ) {
1019 return (
@@ -35,15 +44,13 @@ const ChatBoxPage = () => {
3544 < h2 style = { { textAlign : 'center' } } > CHAT BOX</ h2 >
3645 < div className = "component-row" >
3746 < OramaChatBox
38- index = { {
39- api_key : API_KEY ,
40- endpoint : ENDPOINT ,
41- } }
47+ sourcesMap = { { description : "content" } }
48+ oramaCoreClientInstance = { collectionManager }
4249 style = { { height : '600px' } }
4350 onAnswerSourceClick = { ( e : Event ) => console . log ( e ) }
4451 onAnswerGenerated = { ( e : Event ) => console . log ( e ) }
45- chatMarkdownLinkTitle = { ( { text } ) => text ?. toUpperCase ( ) }
46- chatMarkdownLinkHref = { ( { href } ) => href }
52+ chatMarkdownLinkTitle = { ( { text } : { text : string ; href : string } ) => text ?. toUpperCase ( ) }
53+ chatMarkdownLinkHref = { ( { href } : { text : string ; href : string } ) => href }
4754 onChatMarkdownLinkClicked = { ( e : Event ) => {
4855 console . log ( e )
4956 e . preventDefault ( )
@@ -61,19 +68,17 @@ const SearchBoxPage = () => {
6168 < main >
6269 < h2 style = { { textAlign : 'center' } } > SEARCH BOX</ h2 >
6370 < div className = "component-row" >
64- < OramaSearchButton colorScheme = "system" > Search</ OramaSearchButton >
71+ < OramaSearchButton colorScheme = "system" > Search</ OramaSearchButton >
6572 < OramaSearchBox
73+ resultMap = { { description : "content" } }
6674 onModalClosed = { ( ) => {
6775 console . log ( 'closed' )
6876 } }
69- onModalStatusChanged = { ( e ) => {
77+ onModalStatusChanged = { ( e : CustomEvent ) => {
7078 console . log ( 'Status changed to: ' , e . detail . open )
7179 } }
7280 colorScheme = "system"
73- index = { {
74- api_key : API_KEY ,
75- endpoint : ENDPOINT ,
76- } }
81+ oramaCoreClientInstance = { collectionManager }
7782 suggestions = { [ 'Suggestion 1' , 'Suggestion 2' , 'Suggestion 3' ] }
7883 onSearchCompleted = { ( e : Event ) => console . log ( e ) }
7984 onSearchResultClick = { ( e ) => {
@@ -85,8 +90,8 @@ const SearchBoxPage = () => {
8590 console . log ( e )
8691 e . preventDefault ( )
8792 } }
88- chatMarkdownLinkTitle = { ( { text } ) => text ?. toUpperCase ( ) }
89- chatMarkdownLinkHref = { ( { href } ) => href }
93+ chatMarkdownLinkTitle = { ( { text } : { text : string ; href : string } ) => text ?. toUpperCase ( ) }
94+ chatMarkdownLinkHref = { ( { href } : { text : string ; href : string } ) => href }
9095 onChatMarkdownLinkClicked = { ( e ) => {
9196 alert ( 'Callback on client side' )
9297 e . preventDefault ( )
0 commit comments