mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-09-26 09:34:13 +08:00
refactor: move codes into src folder
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<h3>SQL Chat</h3>
|
<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>
|
</div>
|
||||||
|
|
||||||
## What
|
## What
|
||||||
|
@ -14,6 +14,23 @@ interface Props {
|
|||||||
close: () => void;
|
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 = {
|
const defaultConnection: Connection = {
|
||||||
id: "",
|
id: "",
|
||||||
title: "",
|
title: "",
|
||||||
@ -29,6 +46,7 @@ const CreateConnectionModal = (props: Props) => {
|
|||||||
const connectionStore = useConnectionStore();
|
const connectionStore = useConnectionStore();
|
||||||
const [connection, setConnection] = useState<Connection>(defaultConnection);
|
const [connection, setConnection] = useState<Connection>(defaultConnection);
|
||||||
const [showDeleteConnectionModal, setShowDeleteConnectionModal] = useState(false);
|
const [showDeleteConnectionModal, setShowDeleteConnectionModal] = useState(false);
|
||||||
|
const [sslType, setSSLType] = useState<SSLType>("none");
|
||||||
const [isRequesting, setIsRequesting] = useState(false);
|
const [isRequesting, setIsRequesting] = useState(false);
|
||||||
const showDatabaseField = connection.engineType === Engine.PostgreSQL;
|
const showDatabaseField = connection.engineType === Engine.PostgreSQL;
|
||||||
const isEditing = editConnection !== undefined;
|
const isEditing = editConnection !== undefined;
|
||||||
@ -190,6 +208,24 @@ const CreateConnectionModal = (props: Props) => {
|
|||||||
onChange={(e) => setPartialConnection({ password: e.target.value })}
|
onChange={(e) => setPartialConnection({ password: e.target.value })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</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>
|
||||||
<div className="modal-action w-full flex flex-row justify-between items-center space-x-2">
|
<div className="modal-action w-full flex flex-row justify-between items-center space-x-2">
|
||||||
<div>
|
<div>
|
@ -1,6 +1,6 @@
|
|||||||
import { openAIApiEndpoint, openAIApiKey } from "@/utils";
|
|
||||||
import { createParser, ParsedEvent, ReconnectInterval } from "eventsource-parser";
|
import { createParser, ParsedEvent, ReconnectInterval } from "eventsource-parser";
|
||||||
import { NextRequest } from "next/server";
|
import { NextRequest } from "next/server";
|
||||||
|
import { openAIApiEndpoint, openAIApiKey } from "@/utils";
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
runtime: "edge",
|
runtime: "edge",
|
@ -1,4 +1,4 @@
|
|||||||
import { Id, Timestamp } from "./";
|
import { Id, Timestamp } from ".";
|
||||||
|
|
||||||
export interface Chat {
|
export interface Chat {
|
||||||
id: string;
|
id: string;
|
@ -1,4 +1,4 @@
|
|||||||
import { Id } from "./";
|
import { Id } from ".";
|
||||||
|
|
||||||
export enum Engine {
|
export enum Engine {
|
||||||
MySQL = "MYSQL",
|
MySQL = "MYSQL",
|
@ -1,4 +1,4 @@
|
|||||||
import { Id } from "./";
|
import { Id } from ".";
|
||||||
|
|
||||||
export interface Database {
|
export interface Database {
|
||||||
connectionId: Id;
|
connectionId: Id;
|
@ -1,4 +1,4 @@
|
|||||||
import { Id, Timestamp } from "./";
|
import { Id, Timestamp } from ".";
|
||||||
|
|
||||||
export enum CreatorRole {
|
export enum CreatorRole {
|
||||||
System = "system",
|
System = "system",
|
@ -1,6 +1,6 @@
|
|||||||
/** @type {import('tailwindcss').Config} */
|
/** @type {import('tailwindcss').Config} */
|
||||||
module.exports = {
|
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: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
zIndex: {
|
zIndex: {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./*"]
|
"@/*": ["./src/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||||
|
Reference in New Issue
Block a user