Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
262 changes: 262 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
{
"tailwindCSS.includeLanguages": {
"javascript": "javascript",
"javascriptreact": "javascriptreact",
"typescript": "typescript",
"typescriptreact": "typescriptreact",
"plaintext": "html"
},
"tailwindCSS.emmetCompletions": true,
"editor.inlineSuggest.enabled": true,
"css.validate": false,
"files.associations": {
"*.css": "tailwindcss",
"*.ts": "typescript",
"*.js": "javascript",
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.lineHeight": 25,
"editor.suggestLineHeight": 50,
"editor.padding.top": 20,
"editor.padding.bottom": 20,
"editor.fontFamily": "Operator Mono Lig",
"editor.fontWeight": "600",
"terminal.integrated.defaultProfile.windows": "Git Bash",
"editor.codeLensFontFamily": "Operator Mono Lig",
"editor.fontLigatures": "'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'zero', 'onum'",
"editor.maxTokenizationLineLength": 20000000,
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
},
"editor.tokenColorCustomizations": {
"keywords": {
"foreground": "#08fddd",
"fontStyle": "italic bold"
},
"comments": {
"foreground": "#939DA5",
"fontStyle": "italic bold"
},
"textMateRules": [
{
"scope": ["storage.type.function.arrow.js","meta.arrow.js"],
"settings": {
"foreground": "#ffc800",
"fontStyle": ""
},
},
{
"scope": [
"meta.object-literal.key.js",
"meta.object.member.js",
"meta.objectliteral.js",
"meta.block.js",
"meta.function.expression.js",
"meta.var.expr.js",
"source.js",
],
"settings": {
"foreground": "#ffb700",
"fontStyle": "italic bold"
}
},
{
"scope": [
"variable.other.readwrite.js",
"meta.object.member.js",
"meta.objectliteral.js",
"meta.object.member.js",
"meta.objectliteral.js",
"meta.block.js",
"meta.function.expression.js",
"meta.var.expr.js",
"source.js",
],
"settings": {
"foreground": "#4afc4d",
"fontStyle": "italic bold"
}
},
{
"scope": [
"variable.other.object.js",
"meta.function-call.js",
"source.js",
],
"settings": {
"foreground": "#b3ff00",
"fontStyle": "italic bold"
}
},
{
"scope": [
"variable.other.constant.js",
"meta.definition.variable.js",
"meta.var-single-variable.expr.js",
"meta.var.expr.js",
"source.js",
],
"settings": {
"foreground": "#ff5e00",
"fontStyle": "bold"
}
},
{
"scope": [
"entity.other.attribute-name.html",
"meta.attribute.html",
],
"settings": {
"fontStyle": "italic bold"
}
},
{
"scope": [
"support.class.php",
"support.other.namespace.php",
"source.php",
],
"settings": {
"foreground": "#ff6a00",
"fontStyle": "bold"
}
},
{
"scope": [
"keyword.other.use.php",
"meta.use.php",
"source.php",
],
"settings": {
"foreground": "#b361ff",
"fontStyle": "bold"
}
},
{
"scope": [
"string.quoted.single.php",
"entity.name.function.php",
"source.php",
],
"settings": {
"foreground": "#fb7f04",
"fontStyle": "bold"
}
},
{
"scope": [
"comment.block.blade",
"comment.line.double-slash.php",
"punctuation.definition.comment.php",
"source.php",
],
"settings": {
"foreground": "#fffefd42",
"fontStyle": "italic bold"
}
},
{
"scope": [
"entity.name.function.php",
"meta.method-call.php",
"source.php",
],
"settings": {
"foreground": "#70fd04",
"fontStyle": "bold"
}
},
{
"scope": [
"support.function.funchand.php",
"source.php",
],
"settings": {
"foreground": "#f9fd04",
"fontStyle": "bold"
}
},
{
"scope": [
"support.class.component.tsx",
],
"settings": {
"foreground": "#f8c303",
"fontStyle": "bold"
}
}
]
},
"gitlens.defaultDateFormat": null,
"gitlens.defaultDateShortFormat": null,
"gitlens.defaultTimeFormat": null,
"php.validate.executablePath": "C:/php8/php.exe",
"javascript.updateImportsOnFileMove.enabled": "always",
"[dart]": {
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.rulers": [80],
"editor.selectionHighlight": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestSelection": "first",
"editor.tabCompletion": "onlySnippets",
"editor.wordBasedSuggestions": "off"
},
"[php]": {
"editor.defaultFormatter": "bmewburn.vscode-intelephense-client"
},
"editor.minimap.enabled": false,
"php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar",
"php.validate.run": "onType",
"php-docblocker.alignParams": true,
"php-docblocker.alignReturn": true,
"php-docblocker.qualifyClassNames": true,
"git.autofetch": true,
"[vue]": {
"editor.defaultFormatter": "Vue.volar"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"typescript.updateImportsOnFileMove.enabled": "always",
"js/ts.implicitProjectConfig.experimentalDecorators": true,
"settingsSync.ignoredExtensions": [],
"git.enableSmartCommit": true,
"remote.SSH.remotePlatform": {
"103.189.234.201": "linux"
},
"editor.tabSize": 2,
"explorer.confirmDelete": false,
"window.zoomLevel": 1,
"[typescript]": {},
"yaml.schemas": {
"file:///c%3A/Users/user/.vscode/extensions/atlassian.atlascode-3.4.12/resources/schemas/pipelines-schema.json": "bitbucket-pipelines.yml"
},
"php.executablePath": "",
"emmet.includeLanguages": {
"blade":"html",
},
"workbench.iconTheme": "Monokai Pro (Filter Machine) Icons",
"workbench.colorTheme": "Monokai Pro (Filter Machine)",
"[javascript]": {
"editor.fontLigatures": true,
"editor.maxTokenizationLineLength": 2500
},
"nxConsole.showNodeVersionOnStartup": false,
"workbench.startupEditor": "none",
"[plaintext]": {

"editor.unicodeHighlight.ambiguousCharacters": false,
"editor.unicodeHighlight.invisibleCharacters": false
},
"workbench.settings.applyToAllProfiles": [

],
"terminal.integrated.fontFamily": "monospace",
"[typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"editor.fontSize": 12,
}
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ Using these free or trial options can help you add an AI chatbot or similar func
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
```
- Confirm the API works by visiting `http://localhost:8000/docs`.
- Note for running using vEnv - becuase gemini ned latest python -v, please follow these
```
python3 -m venv venv
source venv/bin/activate
python3.10 main.py
```

3. **Frontend Setup**
- Navigate to the `frontend` directory.
Expand Down Expand Up @@ -149,6 +155,18 @@ Using these free or trial options can help you add an AI chatbot or similar func
- **UI Libraries**: Feel free to use any UI library or styling approach (Tailwind, CSS modules, etc.) if desired.
- **Extensions**: You can incorporate charts, filters, or sorting to demonstrate extra skills.

7. **For AI**
- please before run this fork use the your api key, and place inside ```./bakcend/.env```, am use gemini api, so you must cinfigure "GEMINI_API_KEY" inside .env file

---

## Screenshot
![alt text](image.png)
![alt text](image-1.png)
![alt text](image-2.png)
![alt text](image-3.png)
![alt text](image-4.png)
![alt text](image-5.png)
![alt text](image-6.png)
![alt text](image-7.png)
**Good luck, and have fun building your Sales Dashboard!**
Binary file added backend/__pycache__/main.cpython-310.pyc
Binary file not shown.
Binary file added backend/__pycache__/main.cpython-38.pyc
Binary file not shown.
45 changes: 30 additions & 15 deletions backend/main.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,48 @@
import asyncio
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
from fastapi.responses import StreamingResponse
import os
import json
from dotenv import load_dotenv
import uvicorn
from google import genai

load_dotenv()

app = FastAPI()

# Load dummy data
with open("dummyData.json", "r") as f:
with open("../dummyData.json", "r") as f:
DUMMY_DATA = json.load(f)

# Read the GEMINI_API_KEY from the environment
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")

@app.get("/api/data")
def get_data():
"""
Returns dummy data (e.g., list of users).
"""
return DUMMY_DATA

import asyncio

async def stream_chunks(text: str):
# Just simulate streaming the response word-by-word
for word in text.split():
yield word + " "
await asyncio.sleep(0.05) # simulate delay

@app.post("/api/ai")
async def ai_endpoint(request: Request):
"""
Accepts a user question and returns a placeholder AI response.
(Optionally integrate a real AI model or external service here.)
"""
body = await request.json()
user_question = body.get("question", "")

# Placeholder logic: echo the question or generate a simple response
# Replace with real AI logic as desired (e.g., call to an LLM).
return {"answer": f"This is a placeholder answer to your question: {user_question}"}
user_prompt = body.get("prompt", "")

client = genai.Client(api_key=GEMINI_API_KEY)
response = client.models.generate_content(
model="gemini-2.0-flash-001",
contents=user_prompt,
)
print(response.text)

return StreamingResponse(stream_chunks(response.text), media_type="text/plain")

if __name__ == "__main__":
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
32 changes: 30 additions & 2 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
fastapi
uvicorn
annotated-types==0.7.0
anyio==4.9.0
asyncio==3.4.3
cachetools==5.5.2
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
dotenv==0.9.9
exceptiongroup==1.2.2
fastapi==0.115.12
google-auth==2.39.0
google-genai==1.11.0
h11==0.14.0
httpcore==1.0.8
httpx==0.28.1
idna==3.10
pyasn1==0.6.1
pyasn1_modules==0.4.2
pydantic==2.11.3
pydantic_core==2.33.1
python-dotenv==1.1.0
requests==2.32.3
rsa==4.9.1
sniffio==1.3.1
starlette==0.46.2
typing-inspection==0.4.0
typing_extensions==4.13.2
urllib3==2.4.0
uvicorn==0.34.2
websockets==15.0.1
Loading