Spaces:
Runtime error
Runtime error
matt HOFFNER
commited on
Commit
Β·
c79b0f3
1
Parent(s):
70ff588
cleanup
Browse files
src/components/ChatWindow.jsx
CHANGED
@@ -7,6 +7,10 @@ import Loader from "./Loader";
|
|
7 |
import { RecursiveCharacterTextSplitter } from 'langchain/text_splitter';
|
8 |
import { XenovaTransformersEmbeddings } from '../embed/hf';
|
9 |
import { MemoryVectorStore } from "langchain/vectorstores/memory";
|
|
|
|
|
|
|
|
|
10 |
|
11 |
function ChatWindow({
|
12 |
stopStrings,
|
@@ -42,7 +46,6 @@ function ChatWindow({
|
|
42 |
new XenovaTransformersEmbeddings()
|
43 |
)
|
44 |
const queryResult = await vectorStore.similaritySearch(userInput, 2);
|
45 |
-
console.log("queryResult", queryResult);
|
46 |
qaPrompt =
|
47 |
`You are an AI assistant providing helpful advice. You are given the following extracted parts of a long document and a question. Provide a conversational answer based on the context provided.
|
48 |
You should only provide hyperlinks that reference the context below. Do NOT make up hyperlinks.
|
@@ -111,11 +114,13 @@ function ChatWindow({
|
|
111 |
<div>
|
112 |
<form onSubmit={handleSubmit}>
|
113 |
<div className="flex">
|
114 |
-
|
115 |
-
style={{ width: '95%', padding: '10px'}}
|
116 |
value={userInput}
|
117 |
placeholder="Say something..."
|
118 |
onChange={handleChange}
|
|
|
|
|
|
|
119 |
/>
|
120 |
</div>
|
121 |
</form>
|
@@ -128,7 +133,7 @@ function ChatWindow({
|
|
128 |
<div className="flex justify-start m-2">
|
129 |
<div>
|
130 |
<div>
|
131 |
-
<
|
132 |
onClick={handleSubmit}
|
133 |
className="submit"
|
134 |
style={{ height: "65px", width: "65px", float: "right" }}
|
@@ -145,9 +150,10 @@ function ChatWindow({
|
|
145 |
width="40"
|
146 |
height="40"
|
147 |
/>
|
148 |
-
</
|
149 |
-
|
150 |
<FileLoader setFileText={setFileText} />
|
|
|
151 |
</div>
|
152 |
|
153 |
<div
|
@@ -160,7 +166,6 @@ function ChatWindow({
|
|
160 |
marginTop: "2px",
|
161 |
}}
|
162 |
></div>
|
163 |
-
|
164 |
</div>
|
165 |
</div>
|
166 |
</div>
|
|
|
7 |
import { RecursiveCharacterTextSplitter } from 'langchain/text_splitter';
|
8 |
import { XenovaTransformersEmbeddings } from '../embed/hf';
|
9 |
import { MemoryVectorStore } from "langchain/vectorstores/memory";
|
10 |
+
import {
|
11 |
+
Button,
|
12 |
+
TextInput,
|
13 |
+
} from "react95";
|
14 |
|
15 |
function ChatWindow({
|
16 |
stopStrings,
|
|
|
46 |
new XenovaTransformersEmbeddings()
|
47 |
)
|
48 |
const queryResult = await vectorStore.similaritySearch(userInput, 2);
|
|
|
49 |
qaPrompt =
|
50 |
`You are an AI assistant providing helpful advice. You are given the following extracted parts of a long document and a question. Provide a conversational answer based on the context provided.
|
51 |
You should only provide hyperlinks that reference the context below. Do NOT make up hyperlinks.
|
|
|
114 |
<div>
|
115 |
<form onSubmit={handleSubmit}>
|
116 |
<div className="flex">
|
117 |
+
<TextInput
|
|
|
118 |
value={userInput}
|
119 |
placeholder="Say something..."
|
120 |
onChange={handleChange}
|
121 |
+
fullWidth
|
122 |
+
multiline
|
123 |
+
rows={3}
|
124 |
/>
|
125 |
</div>
|
126 |
</form>
|
|
|
133 |
<div className="flex justify-start m-2">
|
134 |
<div>
|
135 |
<div>
|
136 |
+
<Button
|
137 |
onClick={handleSubmit}
|
138 |
className="submit"
|
139 |
style={{ height: "65px", width: "65px", float: "right" }}
|
|
|
150 |
width="40"
|
151 |
height="40"
|
152 |
/>
|
153 |
+
</Button>
|
154 |
+
|
155 |
<FileLoader setFileText={setFileText} />
|
156 |
+
<Button onClick={handleClear}>Clear</Button>
|
157 |
</div>
|
158 |
|
159 |
<div
|
|
|
166 |
marginTop: "2px",
|
167 |
}}
|
168 |
></div>
|
|
|
169 |
</div>
|
170 |
</div>
|
171 |
</div>
|
src/components/DashButton.tsx
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import React from 'react';
|
2 |
import { MouseEventHandler, ReactElement } from 'react';
|
|
|
3 |
|
4 |
interface Props {
|
5 |
handleClick: MouseEventHandler<HTMLButtonElement>;
|
@@ -7,12 +8,12 @@ interface Props {
|
|
7 |
}
|
8 |
const DashButton = ({ handleClick, children }: Props) => {
|
9 |
return (
|
10 |
-
<
|
11 |
className="border-dashed border-2 border-black rounded-lg py-2 px-4 text-black hover:bg-black hover:text-white transition-all duration-300 ease-in-out"
|
12 |
onClick={handleClick}
|
13 |
>
|
14 |
{children}
|
15 |
-
</
|
16 |
);
|
17 |
};
|
18 |
|
|
|
1 |
import React from 'react';
|
2 |
import { MouseEventHandler, ReactElement } from 'react';
|
3 |
+
import { Button } from 'react95';
|
4 |
|
5 |
interface Props {
|
6 |
handleClick: MouseEventHandler<HTMLButtonElement>;
|
|
|
8 |
}
|
9 |
const DashButton = ({ handleClick, children }: Props) => {
|
10 |
return (
|
11 |
+
<Button
|
12 |
className="border-dashed border-2 border-black rounded-lg py-2 px-4 text-black hover:bg-black hover:text-white transition-all duration-300 ease-in-out"
|
13 |
onClick={handleClick}
|
14 |
>
|
15 |
{children}
|
16 |
+
</Button>
|
17 |
);
|
18 |
};
|
19 |
|