Update debug configuration
(
self,
enabled: bool = None,
log_requests: bool = None,
log_responses: bool = None,
mask_token: bool = None
)
| 1797 | WHERE id = 1 |
| 1798 | """, |
| 1799 | ( |
| 1800 | normalized_image_timeout, |
| 1801 | normalized_video_timeout, |
| 1802 | normalized_max_retries, |
| 1803 | ), |
| 1804 | ) |
| 1805 | else: |
| 1806 | await db.execute( |
| 1807 | """ |
| 1808 | INSERT INTO generation_config (id, image_timeout, video_timeout, max_retries) |
| 1809 | VALUES (1, ?, ?, ?) |
| 1810 | """, |
| 1811 | ( |
| 1812 | normalized_image_timeout, |
| 1813 | normalized_video_timeout, |
| 1814 | normalized_max_retries, |
| 1815 | ), |
| 1816 | ) |
| 1817 | await db.commit() |
| 1818 | |
| 1819 | async def get_call_logic_config(self) -> CallLogicConfig: |
| 1820 | """Get token call logic configuration.""" |
| 1821 | async with self._connect() as db: |
| 1822 | db.row_factory = aiosqlite.Row |
| 1823 | cursor = await db.execute("SELECT * FROM call_logic_config WHERE id = 1") |
| 1824 | row = await cursor.fetchone() |
| 1825 | if row: |
| 1826 | row_dict = dict(row) |
| 1827 | mode = row_dict.get("call_mode") |
| 1828 | if mode not in ("default", "polling"): |
| 1829 | row_dict["call_mode"] = ( |
| 1830 | "polling" if row_dict.get("polling_mode_enabled") else "default" |
| 1831 | ) |
| 1832 | return CallLogicConfig(**row_dict) |
| 1833 | return CallLogicConfig(call_mode="default", polling_mode_enabled=False) |
| 1834 | |
| 1835 | async def update_call_logic_config(self, call_mode: str): |
| 1836 | """Update token call logic configuration.""" |
| 1837 | normalized = "polling" if call_mode == "polling" else "default" |
| 1838 | polling_mode_enabled = normalized == "polling" |
| 1839 | async with self._connect(write=True) as db: |
| 1840 | await db.execute( |
| 1841 | """ |