refactor: move codes into src folder

This commit is contained in:
steven
2023-03-31 16:12:09 +08:00
parent 483e750bc5
commit 861a22f13d
57 changed files with 44 additions and 8 deletions

View File

@ -2,7 +2,7 @@
<div align="center">
<h3>SQL Chat</h3>
<a href="https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fbytebase%2Fsqlchat&env=OPENAI_API_KEY"><img src="https://img.shields.io/badge/deploy%20on-Vercel-brightgreen.svg?style=for-the-badge&logo=vercel" alt="vercel"></a>
<a href="https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fsqlchat%2Fsqlchat&env=OPENAI_API_KEY"><img src="https://img.shields.io/badge/deploy%20on-Vercel-brightgreen.svg?style=for-the-badge&logo=vercel" alt="vercel"></a>
</div>
## What

View File

@ -14,6 +14,23 @@ interface Props {
close: () => void;
}
type SSLType = "none" | "ca-only" | "full";
const SSLTypeOptions = [
{
label: "None",
value: "none",
},
{
label: "CA Only",
value: "ca-only",
},
{
label: "Full",
value: "full",
},
];
const defaultConnection: Connection = {
id: "",
title: "",
@ -29,6 +46,7 @@ const CreateConnectionModal = (props: Props) => {
const connectionStore = useConnectionStore();
const [connection, setConnection] = useState<Connection>(defaultConnection);
const [showDeleteConnectionModal, setShowDeleteConnectionModal] = useState(false);
const [sslType, setSSLType] = useState<SSLType>("none");
const [isRequesting, setIsRequesting] = useState(false);
const showDatabaseField = connection.engineType === Engine.PostgreSQL;
const isEditing = editConnection !== undefined;
@ -190,6 +208,24 @@ const CreateConnectionModal = (props: Props) => {
onChange={(e) => setPartialConnection({ password: e.target.value })}
/>
</div>
{/* TODO: implement SSL textarea */}
<div className="hidden w-full flex-col">
<label className="block text-sm font-medium text-gray-700 mb-1">SSL</label>
<div className="w-full flex flex-row justify-start items-start flex-wrap">
{SSLTypeOptions.map((option) => (
<label key={option.value} className="w-auto flex flex-row justify-start items-center cursor-pointer mr-2 mb-2">
<input
type="radio"
className="radio w-4 h-4 mr-1"
value={option.value}
checked={sslType === option.value}
onChange={(e) => setSSLType(e.target.value as SSLType)}
/>
<span className="text-sm">{option.label}</span>
</label>
))}
</div>
</div>
</div>
<div className="modal-action w-full flex flex-row justify-between items-center space-x-2">
<div>

View File

@ -1,6 +1,6 @@
import { openAIApiEndpoint, openAIApiKey } from "@/utils";
import { createParser, ParsedEvent, ReconnectInterval } from "eventsource-parser";
import { NextRequest } from "next/server";
import { openAIApiEndpoint, openAIApiKey } from "@/utils";
export const config = {
runtime: "edge",

View File

@ -1,4 +1,4 @@
import { Id, Timestamp } from "./";
import { Id, Timestamp } from ".";
export interface Chat {
id: string;

View File

@ -1,4 +1,4 @@
import { Id } from "./";
import { Id } from ".";
export enum Engine {
MySQL = "MYSQL",

View File

@ -1,4 +1,4 @@
import { Id } from "./";
import { Id } from ".";
export interface Database {
connectionId: Id;

View File

@ -1,4 +1,4 @@
import { Id, Timestamp } from "./";
import { Id, Timestamp } from ".";
export enum CreatorRole {
System = "system",

View File

@ -1,6 +1,6 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./pages/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}"],
content: ["./src/pages/**/*.{js,ts,jsx,tsx}", "./src/components/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {
zIndex: {

View File

@ -15,7 +15,7 @@
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./*"]
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],