feat(ai-chat): Add code logic for AI-based data chat

Add the first working code logic both in terms of backend and
frontend-related tasks. Add a detailled system message for improved
results. Add several UI improvements for result display and user
information. Add text input field for direct SQL code comparison.

The implementation of the openAI backend had to be changed due to strict
rate limits of azure OpenAI free tier and was replaced with a regular
openai API key.
This commit is contained in:
Tobias Quadfasel
2024-09-03 14:48:38 +02:00
parent 4b9fa0579e
commit 94b5545173
3 changed files with 189 additions and 54 deletions

View File

@@ -11,7 +11,7 @@ def test_db_connection() -> bool:
This function attempts to establish a connection to an Azure SQL Database
using the connection string stored in the environment variable
'AZURE_SQL_CONNECTION_STRING'. It makes up to 5 attempts to connect,
with a timeout of 240 seconds for each attempt.
with a timeout of 480 seconds for each attempt.
Returns
-------
@@ -22,14 +22,15 @@ def test_db_connection() -> bool:
for i in range(5):
print(f"Trying to connect to Azure SQL Database... Attempt {i + 1}")
try:
pyodbc.connect(connection_string, timeout=240)
pyodbc.connect(connection_string, timeout=480)
print("Connected to Azure SQL Database successfully!")
connected = True
break
except pyodbc.Error as e:
except Exception as e:
print(f"Error connecting to Azure SQL Database: {e}")
connected = False
continue
return connected