Skip to content
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

Fix/UI fix for server integration #39

Merged
merged 6 commits into from
Aug 8, 2024
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ __pycache__/
.Python
build/
develop-eggs/
dist/
# dist/
downloads/
eggs/
.eggs/
Expand Down
25 changes: 25 additions & 0 deletions pipeline/config_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,28 @@ def ui_to_pipeline(ui_json):

log.debug('config_util.py ui_to_pipeline: pipeline_obj', pipeline_obj)
return pipeline_obj


def pipeline_to_ui(pipeline_obj):
ui_obj = {
"id": pipeline_obj['id'],
"name": pipeline_obj['name'],
"knowledge_bases": pipeline_obj['knowledgebases'],
"generative_model": pipeline_obj['generative_model'],
"similarity": {
"on": pipeline_obj['postprocessing']['similarity']['on'],
"cutoff": pipeline_obj['postprocessing']['similarity'].get('similarity_cutoff', 0.7)
},
"colbert_rerank": {
"on": pipeline_obj['postprocessing']['colbertRerank']['on'],
"top_n": pipeline_obj['postprocessing']['colbertRerank'].get('top_n', DEFAULT_TOP_N)
},
"long_context_reorder": {
"on": pipeline_obj['postprocessing']['longContextReorder']['on']
},
"prompt": pipeline_obj['prompt']['template_str']
}

log.debug('config_util.py pipeline_to_ui: ui_obj', ui_obj)
return ui_obj

4 changes: 2 additions & 2 deletions routers/chatbots.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def get_chatbots():
log.info('/api/chatbots loaded')
results = mutil.get_all(CONFIG_DB, CONFIG_PIPELINE_COL, {}, { '_id': 0 })
log.info('/api/chatbots results:', results)
return results
return [cutil.pipeline_to_ui(result) for result in results]

@router.get('/{id}')
async def get_chatbots_id(id: str):
Expand All @@ -38,7 +38,7 @@ async def get_chatbots_id(id: str):
if not results:
return {"message": "no chatbot configuration found"}

return results
return cutil.pipeline_to_ui(results)

@router.post('/')
async def post_chatbots(request: Request):
Expand Down
25 changes: 13 additions & 12 deletions systemd/test.service
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[Unit]
Description=Skateboard backend
After=network-online.target
[Unit]
Description=Skateboard backend
After=network-online.target

[Service]
Type=simple
Restart=always
User=ubuntu
WorkingDirectory=/home/ubuntu/db/
Environment="PYTHONPATH=/home/ubuntu/.pyenv/versions/3.10.12/bin"
ExecStart=/home/ubuntu/.pyenv/shims/pipenv run python /home/ubuntu/db/server.py
[Service]
Type=simple
Restart=always
User=ubuntu
WorkingDirectory=/home/ubuntu/
Environment="PIPENV_PIPFILE=/home/ubuntu/db/Pipfile"
Environment="PYTHONPATH=/home/ubuntu/.local/share/virtualenvs/db-grdQ2Ybz/bin"
ExecStart=/home/ubuntu/.local/bin/pipenv run python -m db.server

[Install]
WantedBy=multi-user.target
[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pnpm-debug.log*
lerna-debug.log*

node_modules
dist
# dist
dist-ssr
*.local

Expand Down
1 change: 1 addition & 0 deletions ui/dist/assets/index-BzAze5ww.css

Large diffs are not rendered by default.

169 changes: 169 additions & 0 deletions ui/dist/assets/index-DF12BThB.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions ui/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<script type="module" crossorigin src="/assets/index-DF12BThB.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BzAze5ww.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
1 change: 1 addition & 0 deletions ui/dist/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions ui/src/services/evaluations-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ async function fetchChatbotHistory() {
const response = await axios.get(`${baseUrl}/api/history`);
console.log('RESPONSE IS:', response)
console.log('RESPONSE.DATA IS:', response.data)

return response.data;
console.log('RESPONSE.DATA[TABLE_DATA] IS:', response.data['table_data'])

return response.data['table_data'];
}

export const evaluationsService = {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/services/knowledge-base-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ async function fetchKnowledgeBases() {
}

async function fetchKnowledgeBaseById(id: string) {
const response = await axios.get(`${baseUrl}/api/knowledge-base/${id}`);
const response = await axios.get(`${baseUrl}/api/knowledge-bases/${id}`);
console.log(response.data);
return response.data;
}
Expand Down
Loading