Skip to content

Commit 139e35d

Browse files
committed
Complete the basic version
1 parent b069569 commit 139e35d

33 files changed

+681
-86
lines changed

.env.example

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Client side
2+
3+
# The app logo, fill with a url or base64 data.
4+
APP_LOGO=""
5+
# The name of the app.
6+
APP_NAME=""
7+
# Summary your app's behavoir and show the users how to user it.
8+
APP_SUMMARY=""
9+
# Example input that shows user how to use the app.
10+
EXAMPLE_INPUT=""
11+
12+
# Server side
13+
14+
# Required, the API key got from OpenAI (https://platform.openai.com/account/api-keys)
15+
OPENAI_API_KEY=""
16+
# Optional, the agent server of OpenAI API. Use this when the offical OpenAI API server is unreachable.
17+
OPENAI_API_BASE_URL=""
18+
# Optional, the system message helps set the behavior of the assistant. (Learn more from https://platform.openai.com/docs/guides/chat/introduction)
19+
SYSTEM_MESSAGE=""
20+
# Optional, the message template to wrap the user inputs, the `{{input}}` string in the template will be replaced by user inputs.
21+
MESSAGE_TEMPLATE=""

.pnp.cjs

+167
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"**/.pnp.*": true
55
},
66
"typescript.tsdk": ".yarn/sdks/typescript/lib",
7-
"typescript.enablePromptUseWorkspaceTsdk": true
7+
"typescript.enablePromptUseWorkspaceTsdk": true,
8+
"editor.formatOnSave": true
89
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

components/background-gradient.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import classNames from "classnames";
2+
3+
export default function BackgroundGradient({
4+
className,
5+
}: {
6+
className?: string;
7+
}) {
8+
return (
9+
<div
10+
className={classNames("absolute -z-10 animate-fluid blur-3xl", className)}
11+
/>
12+
);
13+
}

components/card.tsx

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ReactNode, type CSSProperties } from "react";
2+
import classNames from "classnames";
3+
4+
export default function Card({
5+
children,
6+
className,
7+
style,
8+
}: {
9+
className?: string;
10+
children: ReactNode;
11+
style?: CSSProperties;
12+
}) {
13+
return (
14+
<div
15+
className={classNames(
16+
"isolate rounded-xl border border-gray-600/10 shadow-xl shadow-gray-400/10 transition-all duration-300 dark:shadow-black/0",
17+
className
18+
)}
19+
style={style}
20+
>
21+
{children}
22+
</div>
23+
);
24+
}

config-client.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const client = {
2+
appName: fillDefault(process.env.appName, "OhMyGPT"),
3+
appLogo: process.env.appLogo ?? undefined,
4+
appThemeColor: fillDefault(process.env.appThemeColor, "#22c55e"),
5+
appSummary: fillDefault(process.env.appSummary, "Ask me any thing you want."),
6+
exampleInput: process.env.exampleInput ?? "Ask me any thing.",
7+
};
8+
9+
export default client;
10+
11+
function fillDefault(value: string | undefined, defaultValue: string): string {
12+
return !value ? defaultValue : value;
13+
}

config-server.ts

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const server = {
2+
openAIAPIKey: required(process.env.OPENAI_API_KEY, "OPENAI_API_KEY"),
3+
openAIAPIBaseURL: fillDefault(
4+
process.env.OPENAI_API_BASE_URL,
5+
"https://api.openai.com"
6+
),
7+
systemMessage: optional(process.env.SYSTEM_MESSAGE),
8+
messageTemplate: optional(process.env.MESSAGE_TEMPLATE),
9+
};
10+
11+
export default server;
12+
13+
function fillDefault(value: string | undefined, defaultValue: string): string {
14+
return !value ? defaultValue : value;
15+
}
16+
17+
function required(value: string | undefined, name: string): string {
18+
if (!value) {
19+
throw Error(`The environment ${name} is required but not found.`);
20+
}
21+
22+
return value;
23+
}
24+
25+
function optional(value: string | undefined): string | undefined {
26+
return value ? value : undefined;
27+
}

constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const MESSAGE_DONE_SYMBOL = "[DONE]";

0 commit comments

Comments
 (0)