Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/message-index
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdougal authored Feb 1, 2024
2 parents 47c90fb + 2c29aea commit e4b7dae
Show file tree
Hide file tree
Showing 78 changed files with 1,954 additions and 1,111 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
},

"postCreateCommand": "pip install -r code/requirements.txt -r code/app/requirements.txt -r extensions/backend/requirements.txt",
"postCreateCommand": "./.devcontainer/postCreate.sh",

"customizations": {
"vscode": {
Expand Down
9 changes: 9 additions & 0 deletions .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

pip install --upgrade pip

pip install -r code/requirements.txt -r code/app/requirements.txt -r extensions/backend/requirements.txt

pip install -r code/dev-requirements.txt

pre-commit install
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
extend-ignore = E203, E501
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-build image and run make in dev container
uses: devcontainers/ci@v0.3
with:
imageName: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
cacheFrom: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
runCmd: make ci
refFilterForPush: refs/heads/main
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
architecture: x64
- name: Install dependencies
run: |
pip install -r code/requirements.txt
pip install -r code/requirements.txt -r code/dev-requirements.txt
- name: Run Python tests
run: python -m pytest --rootdir=code -m "not azure"
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# generated frontend files
static/*.html
static/assets/*.js
static/assets/*.map
static/assets/*.css
code/app/static/

# User-specific files
*.rsuser
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
language_version: python3

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
args: [--extend-ignore=E501]
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Before you submit your Pull Request (PR) consider the following guidelines:
* Make your changes in a new git fork:

* Commit your changes using a descriptive commit message
* If you are using the devcontainer, committing code will run black and flake8 to lint python code. You can run `black .` or `flake8 .` at anytime.
* Push your fork to GitHub:
* In GitHub, create a pull request
* If we suggest changes then:
Expand Down
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
SHELL := /bin/bash

.PHONY: help
.DEFAULT_GOAL := help

ENV_FILE := .env
ifeq ($(filter $(MAKECMDGOALS),config clean),)
ifneq ($(strip $(wildcard $(ENV_FILE))),)
ifneq ($(MAKECMDGOALS),config)
include $(ENV_FILE)
export
endif
endif
endif

help: ## 💬 This help message :)
@grep -E '[a-zA-Z_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-23s\033[0m %s\n", $$1, $$2}'

ci: unittest build-frontend ## 🚀 Continuous Integration (called by Github Actions)

unittest: ## 🧪 Run the unit tests
@echo -e "\e[34m$@\e[0m" || true
@python -m pytest -m "not azure"

build-frontend: ## 🏗️ Build the Frontend webapp
@echo -e "\e[34m$@\e[0m" || true
@cd code/app/frontend && npm install && npm run build
29 changes: 19 additions & 10 deletions code/admin/Admin.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import streamlit as st
import os
import logging
import sys
from dotenv import load_dotenv
load_dotenv()

import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
load_dotenv()

logger = logging.getLogger('azure.core.pipeline.policies.http_logging_policy').setLevel(logging.WARNING)
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))

logger = logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(
logging.WARNING
)


st.set_page_config(page_title="Admin", page_icon=os.path.join('images','favicon.ico'), layout="wide", menu_items=None)
st.set_page_config(
page_title="Admin",
page_icon=os.path.join("images", "favicon.ico"),
layout="wide",
menu_items=None,
)

mod_page_style = """
<style>
Expand All @@ -23,14 +30,16 @@
st.markdown(mod_page_style, unsafe_allow_html=True)


col1, col2, col3 = st.columns([1,2,1])
col1, col2, col3 = st.columns([1, 2, 1])
with col1:
st.image(os.path.join('images','logo.png'))
st.image(os.path.join("images", "logo.png"))

st.write("# Chat with your data Solution Accelerator")

st.write("""
st.write(
"""
* If you want to ingest data (pdf, websites, etc.), then use the `Ingest Data` tab
* If you want to explore how your data was chunked, check the `Explore Data` tab
* If you want to adapt the underlying prompts, logging settings and others, use the `Configuration` tab
""")
"""
)
Loading

0 comments on commit e4b7dae

Please sign in to comment.