Skip to content

Commit

Permalink
Merge pull request #104 from GSA-TTS/jim/tags-update
Browse files Browse the repository at this point in the history
fix docs upload auth and tagging UI
  • Loading branch information
jimmoffet authored Oct 10, 2024
2 parents 1802dcd + e9ca2df commit c305ac9
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 152 deletions.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
npm install
npm run format
npm run i18n:parse
22 changes: 9 additions & 13 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
# TODOs

- Videos: playground switching sys prompts
- Make demo Videos: playground switching sys prompts, transfer sys prompt to custom model with docs
- Models and docs need ownership and visibility in database, owner str, visibility [str]
- Ability to share docs/models by pasting an email of another user ("This email is belongs to a sandbox user. They will now have access to the model" / "This email does not belong to a sandbox user"). Probably want comma separation...
- Add links to Doc upload
- Add http links to Doc upload options
- Fix tagging ux, add tags should be clickable, should save when you hit save
- Check and tag multiple docs
- Need initial (Type a message down there 👇 to get started) message for new users
- Check and batch-tag multiple docs
- documents tab needs a spinner when processing docs
- existing tags should be selectable when adding to docs
- Need initial (Type a message down there 👇 to get started / explain that this is a chat interface) message for new users
- Soft outline around new chat and documents buttons
- Remove dangerous items from Workspace, rename Workspace "Documents & More"
- Fix translations for docs & more and search your chats, as well as sign in screen
- Workspace > documents needs a spinner when processing docs
- existing tags should be selectable when adding to docs
- create a couple default custom prompts like /quick-summary ([type something here]) and /quick-summary-from-paste {{clipboard}}
- Unhide Tools from workspace layout
- Chroma is kept in ram... need to swap for redis
- Save and retrieve valves.json data from env instead of json
- Remove pipeline add from admin settings > pipelines
- Investigate RAG set up
- create a couple default custom prompts shortcuts like /quick-summary ([type something here]) and /quick-summary-from-paste {{clipboard}}
- Unhide Tools from Docs & more layout
- Chroma is kept in ram... need to swap for redisVL
6 changes: 3 additions & 3 deletions backend/apps/webui/routers/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def get_documents(user=Depends(get_current_user)):


@router.post("/create", response_model=Optional[DocumentResponse])
async def create_new_doc(form_data: DocumentForm, user=Depends(get_admin_user)):
async def create_new_doc(form_data: DocumentForm, user=Depends(get_current_user)):
doc = Documents.get_doc_by_name(form_data.name)
if doc == None:
doc = Documents.insert_new_doc(user.id, form_data)
Expand Down Expand Up @@ -130,7 +130,7 @@ async def tag_doc_by_name(form_data: TagDocumentForm, user=Depends(get_current_u

@router.post("/doc/update", response_model=Optional[DocumentResponse])
async def update_doc_by_name(
name: str, form_data: DocumentUpdateForm, user=Depends(get_admin_user)
name: str, form_data: DocumentUpdateForm, user=Depends(get_current_user)
):
doc = Documents.update_doc_by_name(name, form_data)
if doc:
Expand All @@ -153,6 +153,6 @@ async def update_doc_by_name(


@router.delete("/doc/delete", response_model=bool)
async def delete_doc_by_name(name: str, user=Depends(get_admin_user)):
async def delete_doc_by_name(name: str, user=Depends(get_current_user)):
result = Documents.delete_doc_by_name(name)
return result
2 changes: 1 addition & 1 deletion backend/dev.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PORT="${PORT:-8080}"
uvicorn main:app --port $PORT --host 0.0.0.0 --forwarded-allow-ips '*' --reload
uvicorn main:app --port $PORT --host 0.0.0.0 --forwarded-allow-ips '*' --reload
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,11 @@ def pipe(
else:
print(f"HTTP Error: {e} Response: {r.text}")
return f"Error with r: {e} ({r.text}) for body:\n{body}\nand filtered_body:\n{filtered_body}"
except Exception as e: # This will catch other errors
print(f"Error without r: {e}")
return f"Error without r: {e}"
except Exception as e:
print(
f"Error without r: {e} for body:\n{body}\nand filtered_body:\n{filtered_body}"
)
return f"Error without r: {e} for body:\n{body}\nand filtered_body:\n{filtered_body}"


# import logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self):
"""

# self.id = "azure_openai_pipeline"
self.name = "FedRamp High Azure GPT 3.5 Turbo"
self.name = "FedRamp High Azure GPT 3.5 Turbo (no vision)"
self.valves = self.Valves(
**{
"AZURE_OPENAI_API_KEY": os.getenv(
Expand Down Expand Up @@ -115,6 +115,15 @@ def pipe(
f"Dropped params: {', '.join(set(body.keys()) - set(filtered_body.keys()))}"
)

# GPT3.5 has no vision
for message in filtered_body["messages"]:
if message["role"] == "user":
if isinstance(message["content"], list):
for content in message["content"]:
if content["type"] == "image_url":
# remove this content from the message
message["content"].remove(content)

try:
r = requests.post(
url=url,
Expand Down
Loading

0 comments on commit c305ac9

Please sign in to comment.