mirror of
https://github.com/StanGirard/quivr.git
synced 2024-08-16 16:40:40 +03:00
fix: make max_brain_size overwritable (#751)
This commit is contained in:
parent
cf376fb59f
commit
25f859a31e
@ -19,15 +19,11 @@ class Brain(BaseModel):
|
||||
temperature: Optional[float] = 0.0
|
||||
max_tokens: Optional[int] = 256
|
||||
files: List[Any] = []
|
||||
max_brain_size = BrainRateLimiting().max_brain_size
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
@property
|
||||
def max_brain_size(self) -> int:
|
||||
brain_rate_limiting = BrainRateLimiting()
|
||||
return brain_rate_limiting.max_brain_size
|
||||
|
||||
@property
|
||||
def commons(self) -> CommonsDep:
|
||||
return common_dependencies()
|
||||
|
@ -8,8 +8,8 @@ from vectorstore.supabase import SupabaseVectorStore
|
||||
|
||||
|
||||
class BrainRateLimiting(BaseSettings):
|
||||
max_brain_size = 52428800
|
||||
max_brain_per_user = 5
|
||||
max_brain_size: int = 52428800
|
||||
max_brain_per_user: int = 5
|
||||
|
||||
|
||||
class BrainSettings(BaseSettings):
|
||||
|
@ -46,9 +46,8 @@ async def upload_file(
|
||||
commons = common_dependencies()
|
||||
|
||||
if request.headers.get("Openai-Api-Key"):
|
||||
brain.max_brain_size = os.getenv(
|
||||
"MAX_BRAIN_SIZE_WITH_KEY", 209715200
|
||||
) # pyright: ignore reportPrivateUsage=none
|
||||
brain.max_brain_size = int(os.getenv("MAX_BRAIN_SIZE_WITH_KEY", 209715200))
|
||||
|
||||
remaining_free_space = brain.remaining_brain_size
|
||||
|
||||
file_size = get_file_size(uploadFile)
|
||||
|
Loading…
Reference in New Issue
Block a user