-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.txt
243 lines (202 loc) · 7.36 KB
/
help.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
"use client";
import React, { useContext } from "react";
import Link from "next/link";
import {
CircleUserRound,
Compass,
Lightbulb,
Youtube,
Code,
SendHorizontal,
Brain,
} from "lucide-react";
import { Context } from "@/context/ContextProvider";
const SynthiaBody = () => {
const {
submit,
recentPrompts,
displayResult,
loading,
result,
input,
setInput,
} = useContext(Context);
console.log(loading, "loading");
return (
<div className="flex-1 min-h-[100vh] pb-[15vh] relative">
<div className="flex items-center justify-between p-5 lg:px-96 text-xl text-gray-400">
<h1 className="font-bold">Synthia AI</h1><p className="text-sm">developed by <Link href="https://xanmoy.me" className="text-indigo-600">
Xanmoy
</Link></p>
{/* <CircleUserRound size={40} className="text-softTextColor" /> */}
</div>
<div className="max-w-[900px] m-auto">
{!displayResult ? (
<>
<div className="my-12 text-5xl font-medium p-5">
<p>
<span className="font-bold text-transparent bg-clip-text bg-gradient-to-r from-indigo-400 to-indigo-600">
Hello, I am Synthia
</span>
</p>
<p>How can I help you today?</p>
</div>
{/* <div className="grid grid-cols-4 gap-5 p-5">
<div className="h-48 p-4 bg-bgSecondaryColor rounded-xl relative cursor-pointer">
<p>Suggest beautiful places to see on an upcoming road trip</p>
<Compass
size={35}
className="p-1 absolute bottom-2 right-2 bg-bgPrimaryColor text-softTextColor rounded-full"
/>
</div>
<div className="h-48 p-4 bg-bgSecondaryColor rounded-xl relative cursor-pointer">
<p>What’s the reaction to and impact of autonomous vehicles</p>
<Lightbulb
size={35}
className="p-1 absolute bottom-2 right-2 bg-bgPrimaryColor text-softTextColor rounded-full"
/>
</div>
<div className="h-48 p-4 bg-bgSecondaryColor rounded-xl relative cursor-pointer">
<p>Come up with a recipe for an upcoming event</p>
<Youtube
size={35}
className="p-1 absolute bottom-2 right-2 bg-bgPrimaryColor text-softTextColor rounded-full"
/>
</div>
<div className="h-48 p-4 bg-bgSecondaryColor rounded-xl relative cursor-pointer">
<p>Evaluate and rank common camera categories</p>
<Code
size={35}
className="p-1 absolute bottom-2 right-2 bg-bgPrimaryColor text-softTextColor rounded-full"
/>
</div>
</div> */}
</>
) : (
<div className="result p-5">
<div className="my-10 flex items-center gap-5 text-gray-400 rounded-2xl p-5 bg-bgSecondaryColor w-full">
<CircleUserRound size={34} className="text-indigo-400" />
<p>{recentPrompts}</p>
</div>
<div className="flex items-start gap-5 text-gray-50 rounded-2xl p-5 bg-indigo-600 w-full">
<Brain size={34} className="text-white"/>
<p
className="text-md font-normal loading-6 "
dangerouslySetInnerHTML={{ __html: result }}
></p>
</div>
</div>
)}
<div className="absolute bottom-0 w-full max-w-[900px] px-5 m-auto">
<form action={submit}>
<div className="flex items-center justify-between gap-5 bg-bgSecondaryColor py-2.5 pr-5 pl-2 rounded-full">
<input
onChange={(e) => setInput(e.target.value)}
value={input}
type="text"
className="flex-1 bg-transparent border-none outline-none p-2 text-md text-gray-400"
placeholder="Enter a prompt here"
/>
<div className="flex cursor-pointer ">
<SendHorizontal type="submit" size={20} className="hover:bg-zinc-600 hover:text-zinc-900"/>
</div>
</div>
</form>
<p className="text-gray-400 text-sm text-center p-3">
Synthia may display inaccurate info, including about people, so
double-check its responses.
</p>
</div>
</div>
</div>
);
};
export default SynthiaBody;
**************************************************************
"use client"
import React, { useContext, useState } from "react";
import Link from "next/link";
import {
CircleUserRound,
Compass,
Lightbulb,
Youtube,
Code,
SendHorizontal,
Brain,
} from "lucide-react";
import { Context } from "@/context/ContextProvider";
const SynthiaBody = () => {
const {
submit,
recentPrompts,
displayResult,
loading,
result,
input,
setInput,
} = useContext(Context);
const [isInputEmpty, setIsInputEmpty] = useState(true);
// Function to handle input change
const handleInputChange = (e) => {
setInput(e.target.value);
setIsInputEmpty(e.target.value.trim() === "");
};
// Function to handle form submission
const handleSubmit = (e) => {
e.preventDefault();
if (!isInputEmpty) {
submit(); // Call the submit function from context provider
}
};
return (
<div className="flex-1 min-h-[100vh] pb-[15vh] relative">
<div className="flex items-center justify-between p-5 lg:px-96 text-xl text-gray-400">
<h1 className="font-bold">Synthia AI</h1>
<p className="text-sm">
developed by{" "}
<Link href="https://xanmoy.me" className="text-indigo-600">
Xanmoy
</Link>
</p>
</div>
<div className="max-w-[900px] m-auto">
{!displayResult ? (
<>
{/* Your initial content */}
</>
) : (
<div className="result p-5">
{/* Your result content */}
</div>
)}
<div className="absolute bottom-0 w-full max-w-[900px] px-5 m-auto">
<form onSubmit={handleSubmit}>
<div className="flex items-center justify-between gap-5 bg-bgSecondaryColor py-2.5 pr-5 pl-2 rounded-full">
<input
onChange={handleInputChange}
value={input}
type="text"
className="flex-1 bg-transparent border-none outline-none p-2 text-md text-gray-400"
placeholder="Enter a prompt here"
/>
<div className={`flex cursor-pointer ${isInputEmpty ? 'pointer-events-none' : ''}`}>
<button
type="submit"
className={`focus:outline-none ${isInputEmpty ? 'opacity-50 cursor-not-allowed' : ''}`}
>
<SendHorizontal size={20} className="hover:bg-zinc-600 hover:text-zinc-900" />
</button>
</div>
</div>
</form>
<p className="text-gray-400 text-sm text-center p-3">
Synthia may display inaccurate info, including about people, so
double-check its responses.
</p>
</div>
</div>
</div>
);
};
export default SynthiaBody;