Skip to content

Commit

Permalink
refactor: Implement lazy loading for images in DashboardV2 and update…
Browse files Browse the repository at this point in the history
… chat route
  • Loading branch information
Arghya721 committed Aug 1, 2024
1 parent f237389 commit 21633b0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
22 changes: 21 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class ChatByIdHistory(BaseModel):
model: str

class SubscriptionRequest(BaseModel):
"""Subscription request model for the subscription endpoint."""
redirect_url: str

model_company_mapping = {
Expand All @@ -151,6 +152,10 @@ class SubscriptionRequest(BaseModel):
"model" : ChatOpenAI,
"premium" : True,
},
"gpt-4o-mini" : {
"model" : ChatOpenAI,
"premium" : False,
},
"gpt-4o": {
"model" : ChatOpenAI,
"premium" : True,
Expand All @@ -167,6 +172,10 @@ class SubscriptionRequest(BaseModel):
"model" : ChatAnthropic,
"premium" : False,
},
"claude-3-5-sonnet-20240620" : {
"model" : ChatAnthropic,
"premium" : True,
},
"mistral-tiny-2312": {
"model" : ChatMistralAI,
"premium" : False,
Expand Down Expand Up @@ -239,6 +248,18 @@ class SubscriptionRequest(BaseModel):
"model" : ChatTogether,
"premium" : True,
},
"meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo" : {
"model" : ChatTogether,
"premium" : True,
},
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo" : {
"model" : ChatTogether,
"premium" : True,
},
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo" : {
"model" : ChatTogether,
"premium" : True,
},
"google/gemma-2b-it": {
"model" : ChatTogether,
"premium" : False,
Expand Down Expand Up @@ -846,7 +867,6 @@ async def is_user_subscribed(token_info: dict = Depends(verify_token)):
raise HTTPException(status_code=500, detail="Internal server error") from e

if __name__ == "__main__":
import uvicorn

# Use multiprocessing for parallel request handling
uvicorn.run(app, host="0.0.0.0", port=5000, log_level="info")
5 changes: 5 additions & 0 deletions web/src/options/modelOptions.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/src/pages/DashboardV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const DashboardV2 = () => {
const [isLoadingGeneratingChat, setIsLoadingGeneratingChat] = useState(false);
const accessToken = localStorage.getItem("accessToken");
const [modal, setModal] = useState(null);
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
const [isSidebarOpen, setIsSidebarOpen] = useState(false);
const [selectedModel, setSelectedModel] = useState(modelOptions[0]);
const [messages, setMessages] = useState([]);
let previousModel = null;
Expand Down

0 comments on commit 21633b0

Please sign in to comment.