diff --git a/README.md b/README.md
index 160a822..33c9bc3 100644
--- a/README.md
+++ b/README.md
@@ -34,11 +34,7 @@ SQL Chat is built by [Next.js](https://nextjs.org/), it supports the following d
## Data Privacy
-- All database connection configs are stored locally in your browser. You can also visit settings to clear the data.
-
-- Only the database schema will be sent to the OpenAI API. No table data will be sent there.
-
-- If you use [sqlchat.ai](https://sqlchat.ai), it will record the anonymised conversations.
+See [SQL Chat Privacy Policy](https://sqlchat.ai/privacy).
## IP Whitelisting
diff --git a/public/privacy.md b/public/privacy.md
new file mode 100644
index 0000000..6b7ed96
--- /dev/null
+++ b/public/privacy.md
@@ -0,0 +1,46 @@
+# SQL Chat Privacy Policy
+
+*Last Updated: May 21, 2023*
+
+We respect your privacy and are committed to protecting your personal information. This Privacy Policy explains how we collect, use, and disclose your personal information when you use our application that calls LLM provider's API.
+
+## Collection of Application Data
+
+* All database connection configs are stored locally in your browser. You can also visit settings to clear the data.
+* We send the database schema to the LLM provider. No table data will be sent there.
+* We collect the conversation message to improve the product.
+
+## Collection of Personal Information
+
+We may collect certain personal information from you when you use our application, such as your name and email address. We collect this information in order to communicate with you about our services and to provide you with technical support.
+
+## Use of Personal Information
+
+We may use your personal information to:
+
+* Communicate with you about our services
+* Provide you with technical support
+* Improve our application and services
+* Comply with legal obligations
+
+## Disclosure of Personal Information
+
+We do not sell, trade, or otherwise transfer your personal information to third parties. However, we may disclose your personal information in the following circumstances:
+
+* To our service providers who assist us in providing our services to you
+* To comply with legal obligations or to protect our rights or the rights of others
+
+## Security of Personal Information
+
+We take reasonable measures to protect your personal information from unauthorized access, disclosure, or destruction. However, no method of transmission over the internet or electronic storage is completely secure, and we cannot guarantee absolute security.
+
+
+## Changes to this Privacy Policy
+
+We may update this Privacy Policy from time to time by posting a new versionon our website. We encourage you to review this Privacy Policy periodically for any changes. Your continued use of our application and services after any modifications to this Privacy Policy will constitute your acceptance of such modifications.
+
+For more information about our privacy and data protection practices, including how to exercise your privacy rights, please visit the [Bytebase Privacy Policy](https://bytebase.com/privacy).
+
+## Contact Us
+
+Please contact us at support@bytebase.com if you have questions about this Privacy Policy.
\ No newline at end of file
diff --git a/public/terms.md b/public/terms.md
new file mode 100644
index 0000000..39c9383
--- /dev/null
+++ b/public/terms.md
@@ -0,0 +1,12 @@
+# Terms of Service
+
+*Last Updated: May 21, 2023*
+
+## Refund Policy
+
+All fees and charges are earned upon receipt by us and are nonrefundable.
+
+
+## Contact Us
+
+Please contact us at support@bytebase.com if you have questions about this Terms of Service.
\ No newline at end of file
diff --git a/src/components/ConversationView/Header.tsx b/src/components/ConversationView/Header.tsx
index 8b190f5..8145bc2 100644
--- a/src/components/ConversationView/Header.tsx
+++ b/src/components/ConversationView/Header.tsx
@@ -49,9 +49,11 @@ const Header = (props: Props) => {
>
-
+ {hasFeature("debug") && (
+
+ )}
diff --git a/src/components/ConversationView/index.tsx b/src/components/ConversationView/index.tsx
index e2e5e9d..39e6979 100644
--- a/src/components/ConversationView/index.tsx
+++ b/src/components/ConversationView/index.tsx
@@ -217,6 +217,9 @@ const ConversationView = () => {
if (settingStore.setting.openAIApiConfig?.endpoint) {
requestHeaders["x-openai-endpoint"] = settingStore.setting.openAIApiConfig?.endpoint;
}
+ if (settingStore.setting.openAIApiConfig?.model) {
+ requestHeaders["x-openai-model"] = settingStore.setting.openAIApiConfig?.model;
+ }
const rawRes = await fetch("/api/chat", {
method: "POST",
body: JSON.stringify({
@@ -311,7 +314,7 @@ const ConversationView = () => {
messages: usageMessageList,
},
{
- headers: session?.user.id ? { Authorization: `Bearer ${session?.user.id}` } : undefined,
+ headers: requestHeaders,
}
)
.catch(() => {
diff --git a/src/components/CreateConnectionModal.tsx b/src/components/CreateConnectionModal.tsx
index 2d61872..4c6d515 100644
--- a/src/components/CreateConnectionModal.tsx
+++ b/src/components/CreateConnectionModal.tsx
@@ -4,27 +4,28 @@ import { toast } from "react-hot-toast";
import TextareaAutosize from "react-textarea-autosize";
import { useConnectionStore } from "@/store";
import { Connection, Engine, ResponseObject, SSLOptions } from "@/types";
-import Select from "./kit/Select";
+import Radio from "./kit/Radio";
import TextField from "./kit/TextField";
import Modal from "./kit/Modal";
import Icon from "./Icon";
import DataStorageBanner from "./DataStorageBanner";
import ActionConfirmModal from "./ActionConfirmModal";
import { useTranslation } from "react-i18next";
+import EngineIcon from "./EngineIcon";
interface Props {
connection?: Connection;
close: () => void;
}
-type SSLType = "none" | "ca-only" | "full";
+type SSLType = "preferred" | "ca-only" | "full";
type SSLFieldType = "ca" | "cert" | "key";
const SSLTypeOptions = [
{
- label: "None",
- value: "none",
+ label: "Preferred",
+ value: "preferred",
},
{
label: "CA Only",
@@ -36,19 +37,35 @@ const SSLTypeOptions = [
},
];
-const defaultPort = {
- [Engine.MySQL]: "3306",
- [Engine.PostgreSQL]: "5432",
- [Engine.MSSQL]: "1433",
- [Engine.TiDBServerless]: "4000",
-};
+const engines = [
+ {
+ type: Engine.MySQL,
+ name: "MySQL",
+ defaultPort: "3306",
+ },
+ {
+ type: Engine.PostgreSQL,
+ name: "PostgreSQL",
+ defaultPort: "5432",
+ },
+ {
+ type: Engine.MSSQL,
+ name: "SQL Server",
+ defaultPort: "1433",
+ },
+ {
+ type: Engine.TiDBServerless,
+ name: "TiDB Serverless",
+ defaultPort: "4000",
+ },
+];
const defaultConnection: Connection = {
id: "",
title: "",
engineType: Engine.MySQL,
host: "",
- port: defaultPort[Engine.MySQL],
+ port: "3306",
username: "",
password: "",
};
@@ -59,7 +76,7 @@ const CreateConnectionModal = (props: Props) => {
const connectionStore = useConnectionStore();
const [connection, setConnection] = useState(defaultConnection);
const [showDeleteConnectionModal, setShowDeleteConnectionModal] = useState(false);
- const [sslType, setSSLType] = useState("none");
+ const [sslType, setSSLType] = useState("preferred");
const [selectedSSLField, setSelectedSSLField] = useState("ca");
const [isRequesting, setIsRequesting] = useState(false);
const showDatabaseField = connection.engineType === Engine.PostgreSQL;
@@ -102,7 +119,6 @@ const CreateConnectionModal = (props: Props) => {
setConnection({
...connection,
...state,
- port: defaultPort[state.engineType || Engine.MySQL],
});
};
@@ -216,17 +232,24 @@ const CreateConnectionModal = (props: Props) => {