Skip to content

Commit

Permalink
⚠ Fix error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
asim-shrestha committed Apr 16, 2023
2 parents 04cd6e6 + cbd099e commit 8562896
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 21 deletions.
21 changes: 9 additions & 12 deletions src/components/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import rehypeHighlight from "rehype-highlight";
import "highlight.js/styles/github-dark.css";
import Button from "./Button";
import { useRouter } from "next/router";
import { clientEnv } from "../env/schema.mjs";

interface ChatWindowProps {
children?: ReactNode;
Expand Down Expand Up @@ -78,13 +77,9 @@ const ChatWindow = ({ messages, children, className }: ChatWindowProps) => {

{messages.length === 0 && (
<>
{!!clientEnv.NEXT_PUBLIC_STRIPE_DONATION_URL && (
<Expand delay={0.7} type="spring">
<DonationMessage
url={clientEnv.NEXT_PUBLIC_STRIPE_DONATION_URL}
/>
</Expand>
)}
<Expand delay={0.7} type="spring">
<DonationMessage />
</Expand>
<Expand delay={0.8} type="spring">
<ChatMessage
message={{
Expand Down Expand Up @@ -252,22 +247,24 @@ const ChatMessage = ({ message }: { message: Message }) => {
);
};

const DonationMessage = ({ url }: { url: string }) => {
const DonationMessage = () => {
const router = useRouter();

return (
<div className="mx-2 my-1 flex flex-col gap-2 rounded-lg border-[2px] border-white/10 bg-blue-500/20 p-1 font-mono hover:border-[#1E88E5]/40 sm:mx-4 sm:flex-row sm:p-3 sm:text-center sm:text-base">
<div className="max-w-none flex-grow">
💝️ Help support the advancement of AgentGPT. 💝
<br />
Please consider donating help fund our high infrastructure costs.
Please consider sponsoring the project on GitHub.
</div>
<div className="flex items-center justify-center">
<Button
className="sm:text m-0 rounded-full text-sm "
onClick={() => void router.push(url)}
onClick={() =>
void router.push("https://github.com/sponsors/reworkd-admin")
}
>
Donate Now 🚀
Support now 🚀
</Button>
</div>
</div>
Expand Down
29 changes: 24 additions & 5 deletions src/components/SettingsDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from "react";
import Button from "./Button";
import { FaKey, FaMicrochip } from "react-icons/fa";
import { FaKey, FaMicrochip, FaExclamationCircle } from "react-icons/fa";
import Dialog from "./Dialog";
import Input from "./Input";
import Dropdown from "./Dropdown";
import { GPT_MODEL_NAMES } from "../utils/constants";
import { GPT_MODEL_NAMES, GPT_4 } from "../utils/constants";

interface SettingsDialogProps {
show: boolean;
Expand Down Expand Up @@ -50,7 +49,27 @@ export default function SettingsDialog(props: SettingsDialogProps) {
additionally select any model OpenAI offers.
</p>
<br />
<p>To use GPT-4, your API Key needs to have the correct access.</p>
<p
className={
customModelName === GPT_4
? "rounded-md border-[2px] border-white/10 bg-yellow-300 text-black"
: ""
}
>
<FaExclamationCircle className="inline-block" />
&nbsp;
<b>
To use the GPT-4 model, you need to also provide the API key for
GPT-4. You can request for it&nbsp;
<a
href="https://openai.com/waitlist/gpt-4-api"
className="text-blue-500"
>
here
</a>
. (ChatGPT Plus subscription will not work)
</b>
</p>
<br />
<div className="text-md relative flex-auto p-2 leading-relaxed">
<Input
Expand All @@ -62,7 +81,7 @@ export default function SettingsDialog(props: SettingsDialogProps) {
}
type="combobox"
value={customModelName}
onChange={(e) => null}
onChange={() => null}
setValue={setCustomModelName}
attributes={{ options: GPT_MODEL_NAMES }}
/>
Expand Down
2 changes: 0 additions & 2 deletions src/env/schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export const serverEnv = {
export const clientSchema = z.object({
// NEXT_PUBLIC_CLIENTVAR: z.string(),
NEXT_PUBLIC_VERCEL_ENV: z.enum(["production", "preview", "development"]),
NEXT_PUBLIC_STRIPE_DONATION_URL: z.string().url().optional(),
NEXT_PUBLIC_FF_AUTH_ENABLED: stringToBoolean()
});

Expand All @@ -76,6 +75,5 @@ export const clientSchema = z.object({
*/
export const clientEnv = {
NEXT_PUBLIC_VERCEL_ENV: process.env.NEXT_PUBLIC_VERCEL_ENV ?? "development",
NEXT_PUBLIC_STRIPE_DONATION_URL: process.env.NEXT_PUBLIC_STRIPE_DONATION_URL,
NEXT_PUBLIC_FF_AUTH_ENABLED: process.env.NEXT_PUBLIC_FF_AUTH_ENABLED
};
4 changes: 2 additions & 2 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const GPT_35_TURBO = "gpt-3.5-turbo";

export const GPT_MODEL_NAMES = [GPT_35_TURBO, "gpt-4"];
export const GPT_4 = "gpt-4";
export const GPT_MODEL_NAMES = [GPT_35_TURBO, GPT_4];

0 comments on commit 8562896

Please sign in to comment.