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

MERGE development INTO master #74

Merged
merged 31 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8b92e5c
MERGE feature/50-adds-settings-and-updates-history-endpoints INTO dev…
ryaneggz Dec 10, 2023
42fb268
resolve conflicts
ryaneggz Dec 10, 2023
4ab5d4c
Merge branch 'master' into development
ryaneggz Dec 10, 2023
f4f3131
Merge branch 'master' into development
ryaneggz Dec 10, 2023
0eeef77
MERGE Feature/rag chat fixed to not be agent INTO development (#53)
ryaneggz Dec 14, 2023
332fd63
MERGE feature/55-update-ollama-rag-chat INTO development (#56)
ryaneggz Dec 17, 2023
510d7b6
MERGE feature/55-update-ollama-rag-chat INTO development (#57)
ryaneggz Dec 17, 2023
47b3660
resolve conflict
ryaneggz Dec 17, 2023
6f3c85c
Update changelog
ryaneggz Dec 17, 2023
cff7d2a
Update changlog
ryaneggz Dec 17, 2023
cb436c9
fixing the retrieval routes
ryaneggz Dec 23, 2023
fe58875
resolve confclits
ryaneggz Dec 23, 2023
db42f6f
Update changelog
ryaneggz Dec 23, 2023
97ca3c5
Update retrieval controller with file upload
ryaneggz Dec 24, 2023
e932202
Adds better error handling for tools in agent
ryaneggz Dec 25, 2023
e1b3bb5
resolve conflict
ryaneggz Dec 25, 2023
9f79651
Merge branch 'master' into development
ryaneggz Dec 25, 2023
9830f08
Changes made (#62)
ryaneggz Dec 26, 2023
08705b0
MERGE feature/64-retricts-what-can-be-passed-to-settings-and-history …
ryaneggz Dec 27, 2023
f454e06
Resolves conflicts
ryaneggz Dec 27, 2023
e69dd11
Small fix in history controller
ryaneggz Dec 27, 2023
8889ec5
Need to account for tags and title on history and settings
ryaneggz Dec 27, 2023
dd8d341
Switch to a set to be more efficient (#71)
ryaneggz Dec 29, 2023
604ec70
A couple adjustments
ryaneggz Dec 29, 2023
1729ff8
reslve conflicts
ryaneggz Dec 29, 2023
dc1aeaf
Had to update the PINECONE_KEY to PINECONE_API_KEY
ryaneggz Dec 29, 2023
2439769
Had to do some updates
ryaneggz Dec 29, 2023
e032315
Resolve conflicts
ryaneggz Dec 29, 2023
b8b0046
update HistoryController with user_id for webhook
ryaneggz Dec 31, 2023
6cad5c3
Update changelog
ryaneggz Dec 31, 2023
ac4dc5d
resolve conflict in changelog
ryaneggz Dec 31, 2023
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
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.1.10
### Added
- Updates HistoryController constructor to include a user_id as request alternative. (2023-12-30)

## 1.1.9
### Added
- Had to update the PINECONE_KEY to PINECONE_API_KEY (2023-12-28)
Expand Down
25 changes: 17 additions & 8 deletions promptengineers/fastapi/controllers/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
class HistoryController(IController):
def __init__(
self,
user_id: str = None,
request = None,
user_repo: IUserRepo = None,
db_name: str = None,
col_name: str = None
):
self.request = request
self.user_id = getattr(request.state, "user_id", None)
self.user_id = user_id or getattr(request.state, "user_id", None)
self.user_repo = user_repo or UserRepo()
self.history_service = MongoService(
host=self.user_repo.find_token(self.user_id, 'MONGO_CONNECTION'),
Expand All @@ -36,8 +37,12 @@ async def index(self, page: int = 1, limit: int = 10):
##############################################################
### Create Chat History
##############################################################
async def create(self, body, keys: set[str] = {'setting', 'messages', 'tags', 'title'}):
body = await self.request.json()
async def create(
self,
body,
keys: set[str] = {'setting', 'messages', 'tags', 'title'}
):
body = await self.request.json() if self.request else body
body = dict((k, body[k]) for k in keys if k in body)
body['user_id'] = ObjectId(self.user_id)
if body.get('setting', False):
Expand All @@ -48,18 +53,22 @@ async def create(self, body, keys: set[str] = {'setting', 'messages', 'tags', 't
##############################################################
### Show Chat History
##############################################################
async def show(self, id: str):
async def show(self, id: str = None, query = None):
result = await self.history_service.read_one(
{'_id': ObjectId(id), 'user_id': ObjectId(self.user_id)}
query or {'_id': ObjectId(id), 'user_id': ObjectId(self.user_id)}
)
return result


##############################################################
### Update Chat History
##############################################################
async def update(self, id: str, body: any, keys: set[str] = {'setting', 'messages', 'tags', 'title'}):
body = await self.request.json()
async def update(
self,
id: str,
body: any,
keys: set[str] = {'setting', 'messages', 'tags', 'title'}
):
body = await self.request.json() if self.request else body
body = dict((k, body[k]) for k in keys if k in body)
if body.get('setting', False):
body['setting'] = ObjectId(body['setting'])
Expand Down