-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: config editor #193
base: master
Are you sure you want to change the base?
feat: config editor #193
Conversation
aac876b
to
c3ad6dc
Compare
@@ -71,7 +72,9 @@ def create_menus() -> list: | |||
*qa_menu(user_permissions=permissions), | |||
*document_menu_items(user_permissions=permissions), | |||
*assistant_menu(user_permissions=permissions), | |||
*feedback_menu_items()] | |||
*feedback_menu_items(), | |||
*mock_menu(user_permissions=permissions), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
behöver vi mock_menu? Togs bort för att säkra upp o skippa onödigt. :)
|
||
from pydantic import BaseModel | ||
|
||
SettingsDict = Dict[str, bool | float | int | str] # Note: order of types is important! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vore fint att få veta varför? 👯♂️ :)
console.log('Try setup settings') | ||
await setup_settings() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting an error where setup_settings
is called before project is created.
The error occurs when code is tested with clean DB (empty MongoDB).
Shuffling the order fixes the problem for me:
@asynccontextmanager
async def lifespan(_app: FastAPI):
console.log('Try setup db')
await setup_db()
console.log('Try setup initial project')
await setup_project()
console.log('Try setup settings')
await setup_settings()
console.log('Try setup Sentry')
await setup_sentry()
console.log('Try setup file parser environment')
await setup_file_parser()
yield
console.log('😴 Unmounting app ...')
console.log('Shutting down Sentry')
client = Hub.current.client
if client is not None:
client.close(timeout=2.0)
payload = BrevoPayload.model_validate(payload.model_dump()) | ||
settings_service = SettingsServiceFactory().get_service() | ||
url = await settings_service.get_value(SettingKey.BREVO_API_URL) | ||
key = await settings_service.get_value(SettingKey.BREVO_API_KEY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
send_mail
raises requests.exceptions.InvalidHeader: Header part (SecretStr('**********')) from ('api-key', SecretStr('**********')) must be of type str or bytes, not <class 'pydantic.types.SecretStr'>
Might be cause by my test environment. There is a value set for FIXED_PIN
in my .env
.
Added ability to edit (some) settings in frontend; very cool 😎.
Not all settings are migrated from
.env
to db yet - onlyFIXED_PIN
,OPENAI_API_KEY
,BREVO_API_URL
andBREVO_API_KEY
right now. Migration requires changing a lot of code since settings fetching is now async/db-dependent.BREAKING CHANGES
FIXED_PIN
can no longer beNone
- instead a blank value''
means "disabled".MAIL_CLIENT
no longer does anything - instead Brevo is always used as long asBREVO_API_KEY
is not blank (''
).