Skip to content

Commit 43f01d6

Browse files
authored
updated README and removed unused code (#54)
* updated README and removed unused code * fixed corpus key bug
1 parent 86ef8d7 commit 43f01d6

6 files changed

Lines changed: 10 additions & 49 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ import { ReactChatbot } from "@vectara/react-chatbot";
6060

6161
<ReactChatbot
6262
customerId="CUSTOMER_ID"
63-
corpusKeys={["CORPUS_KEY_1", "CORPUS_KEY_2", "CORPUS_KEY_N"]}
63+
corpusKeys={"CORPUS_KEY_1,CORPUS_KEY_2,CORPUS_KEY_N"}
6464
apiKey="API_KEY"
6565
title="My Chatbot"
6666
placeholder="Chat with your AI assistant"
@@ -163,7 +163,7 @@ import { useChat } from "@vectara/react-chatbot/lib/useChat";
163163
const { sendMessage, activeMessage, messageHistory, isLoading, isStreamingResponse, hasError, startNewConversation } =
164164
useChat({
165165
customerId: "CUSTOMER_ID",
166-
corpusIds: ["CORPUS_ID_1", "CORPUS_ID_2", "CORPUS_ID_N"],
166+
corpusKeys: "CORPUS_ID_1,CORPUS_ID_2,CORPUS_ID_N",
167167
apiKey: "API_KEY",
168168
enableStreaming: true, // Enable streaming, false otherwise. Defaults to true.
169169
language: "fra" // Response language. Defaults to "eng" for English. See our types for more information.
@@ -231,7 +231,7 @@ export const App = (props: Props): ReactNode => {
231231
setChatWidget(
232232
<ReactChatbot
233233
customerId="CUSTOMER_ID"
234-
corpusKeys={["CORPUS_KEY_1", "CORPUS_KEY_2", "CORPUS_KEY_N"]}
234+
corpusKeys={"CORPUS_KEY_1,CORPUS_KEY_2,CORPUS_KEY_N"}
235235
apiKey="API_KEY"
236236
/>
237237
);

docs/src/components/ConfigurationDrawer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export const ConfigurationDrawer = ({
120120

121121
<VuiSpacer size="m" />
122122

123-
<VuiFormGroup label="Corpus Key" labelFor="corpusId">
123+
<VuiFormGroup label="Corpus Key" labelFor="corpusKey">
124124
<VuiTextInput value={corpusKeys} onChange={onUpdateCorpusKeys} />
125125
</VuiFormGroup>
126126

docs/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const App = () => {
115115
const [placeholder, setPlaceholder] = useState<string>(DEFAULT_PLACEHOLDER);
116116
const [inputSize, setInputSize] = useState<"large" | "medium">("large");
117117
const [isStreamingEnabled, setIsStreamingEnabled] = useState<boolean>(true);
118-
const [numberOfSearchResults, setNumberOfSearchResults] = useState<number>(15);
118+
const [numberOfSearchResults, setNumberOfSearchResults] = useState<number>(10);
119119
const [language, setLanguage] = useState<SummaryLanguage>("eng");
120120
const [emptyStateJsx, setEmptyStateJsx] = useState<string>("");
121121
const [exampleQuestions, setExampleQuestions] = useState<string>("What is Vectara?, How does RAG work?");
@@ -308,7 +308,7 @@ export const App = () => {
308308
corpusKeys: DEFAULT_CORPUS_KEY,
309309
apiKey: DEFAULT_API_KEY,
310310
enableStreaming: true, // Enable streaming, false otherwise. Defaults to true.
311-
numberOfSearchResults: 15, // Number of search results to use for summary.
311+
numberOfSearchResults: 10, // Number of search results to use for summary.
312312
language: "fra" // Response language. Defaults to "eng" for English.
313313
});
314314

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vectara/react-chatbot",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "A Vectara-powered Chatbot component",
55
"main": "lib/index.js",
66
"module": "lib/index.js",

src/index.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class ReactChatbotWebComponent extends HTMLElement {
6969

7070
public connectedCallback() {
7171
const customerId = this.getAttribute("customerId") ?? "";
72-
const corpusKeys = (this.getAttribute("corpuskey") ?? "");
72+
const corpusKeys = (this.getAttribute("corpuskeys") ?? "");
7373
const apiKey = this.getAttribute("apiKey") ?? "";
7474
const title = this.getAttribute("title") ?? undefined;
7575
const placeholder = this.getAttribute("placeholder") ?? undefined;
@@ -88,6 +88,7 @@ class ReactChatbotWebComponent extends HTMLElement {
8888
const enableStreaming =
8989
this.getAttribute("enableStreaming") !== null ? this.getAttribute("enableStreaming") == "true" : undefined;
9090

91+
console.log(corpusKeys)
9192
ReactDOM.render(
9293
<div>
9394
<ChatView
@@ -138,11 +139,7 @@ export const ReactChatbot = (props: Props) => {
138139
const typedProps = props as Record<string, any>;
139140
const updatedProps = Object.keys(props).reduce((acc: Record<string, string>, propName: string) => {
140141
if (propName === "emptyStateDisplay") return acc;
141-
if (propName === "corpusIds") {
142-
acc[propName] = typedProps["corpusIds"].join(" ");
143-
} else {
144-
acc[propName] = typedProps[propName];
145-
}
142+
acc[propName] = typedProps[propName];
146143

147144
return acc;
148145
}, {});

src/types.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,6 @@ export type SearchResultWithSnippet = SearchResult & {
1414
};
1515
};
1616

17-
18-
19-
export type DocMetadata = {
20-
name: string;
21-
value: string;
22-
};
23-
24-
export type SearchResponse = {
25-
document: SearchResponseDoc[];
26-
response: SearchResponseResult[];
27-
summary: SearchResponseSummary[];
28-
};
29-
30-
type SearchResponseDoc = {
31-
id: string;
32-
metadata: DocMetadata[];
33-
};
34-
35-
type SearchResponseResult = {
36-
corpusKey: {
37-
corpusId: string;
38-
customerId: string;
39-
dim: string[];
40-
};
41-
documentIndex: string;
42-
resultLength: number;
43-
resultOffset: number;
44-
score: number;
45-
text: string;
46-
};
47-
48-
type SearchResponseSummary = {
49-
text?: string;
50-
status?: string;
51-
};
52-
5317
export const SUMMARY_LANGUAGES = [
5418
"auto",
5519
"eng",

0 commit comments

Comments
 (0)