mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-07-24 07:18:18 +08:00
refactor: move codes into src folder
This commit is contained in:
@ -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
|
||||
|
@ -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>
|
@ -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",
|
@ -1,4 +1,4 @@
|
||||
import { Id, Timestamp } from "./";
|
||||
import { Id, Timestamp } from ".";
|
||||
|
||||
export interface Chat {
|
||||
id: string;
|
@ -1,4 +1,4 @@
|
||||
import { Id } from "./";
|
||||
import { Id } from ".";
|
||||
|
||||
export enum Engine {
|
||||
MySQL = "MYSQL",
|
@ -1,4 +1,4 @@
|
||||
import { Id } from "./";
|
||||
import { Id } from ".";
|
||||
|
||||
export interface Database {
|
||||
connectionId: Id;
|
@ -1,4 +1,4 @@
|
||||
import { Id, Timestamp } from "./";
|
||||
import { Id, Timestamp } from ".";
|
||||
|
||||
export enum CreatorRole {
|
||||
System = "system",
|
@ -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: {
|
||||
|
@ -15,7 +15,7 @@
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
|
Reference in New Issue
Block a user