chore: update connection creation modal

This commit is contained in:
steven
2023-03-29 16:59:37 +08:00
parent efc30299e8
commit 7bb68fd28a
2 changed files with 4 additions and 2 deletions

View File

@ -32,7 +32,8 @@ const CreateConnectionModal = (props: Props) => {
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;
const allowSave = connection.host !== "" && connection.username !== ""; const allowSave =
connection.host !== "" && connection.username !== "" && (connection.engineType === Engine.PostgreSQL ? connection.database : true);
useEffect(() => { useEffect(() => {
if (show) { if (show) {

View File

@ -18,8 +18,9 @@ export const getAssistantById = (id: Id) => {
// getPromptOfAssistant define the special prompt for each assistant. // getPromptOfAssistant define the special prompt for each assistant.
export const getPromptGeneratorOfAssistant = (assistant: User) => { export const getPromptGeneratorOfAssistant = (assistant: User) => {
const basicPrompt = `Please follow the instructions to answer the questions. const basicPrompt = `Please follow the instructions to answer the questions:
1. Set the language to the markdown code block for each code block. For example, \`SELECT * FROM table\` is SQL. 1. Set the language to the markdown code block for each code block. For example, \`SELECT * FROM table\` is SQL.
2. Please be careful to return only key information, and try not to make it too long.
`; `;
if (assistant.id === "sql-assistant") { if (assistant.id === "sql-assistant") {
return (schema: string) => return (schema: string) =>