Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
yalattas committed Apr 26, 2023
2 parents d61fc63 + 91ff946 commit 7f8c5ba
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 71 deletions.
15 changes: 14 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,17 @@ sast:
stage: test
include:
- template: Security/SAST.gitlab-ci.yml
# GitLab test ---------------------------------------------------
# GitLab test ---------------------------------------------------
# Flat job: registering release to GitLab release management section
release_job:
image: registry.gitlab.com/gitlab-org/release-cli:latest
stage: release
rules:
- if: $CI_COMMIT_TAG
script:
- echo 'release job'
release:
name: 'Release $CI_COMMIT_TAG'
tag_name: '$CI_COMMIT_TAG'
description: './CHANGELOG.md'
# Flat job: registering release to GitLab release management section
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [v0.0.2](#v0.0.1) - 2023-04-26 - Released - Alpha
## [v0.0.3](#v0.0.3) - 2023-04-26 - Released - Alpha

### Hotfix
- [bug: making call without credentials](#8)
- System was throwing error in case user didn't provide credentials and attempts to submit a prompt, fixed by validating credentials first on utility layer

## [v0.0.2](#v0.0.2) - 2023-04-26 - Released - Alpha

### Added
- [ai command](#6)
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# build package
```
python setup.py sdist
```
# install package
```
pip install .
pip install mindmate
```

> It's not recommended to install in virtual environment _(except for testing)_ try it with default `pip`
# usage
```
mindmate [ARGUMENT] [OPTIONS] [OPTIONS] [OPTIONS] --help
$ mindmate [ARGUMENT] [OPTIONS] [OPTIONS] [OPTIONS] --help
```

# examples
```
$ mindmate configure
$ mindmate ai prompting list
$ mindmate chat -P openai \
-m text-davinci-003 \
-p "Act as a professional developer, provide best file structure for openAPI framework"
```

# compatibility
Expand Down
39 changes: 0 additions & 39 deletions example.py

This file was deleted.

20 changes: 0 additions & 20 deletions mindmate/commands/configure.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
import click
import yaml
import uuid
import os
from mindmate.utils.utils import utility
from mindmate.utils.conf import constants

@click.command()
def configure():
"""collect keys from user and save it into state file as yaml"""

# PATH = '~/.mindmate'
# FILE_NAME = 'environment.yaml'

while not os.path.isfile(constants.FILE_PATH+'/'+constants.FILE_NAME):
try:
os.makedirs(constants.FILE_PATH)
except FileExistsError as f:
pass
data = {
'version':1,
'keys': {
'openai_token':'xxxx',
'openai_id':'xxxx',
}
}
with open(constants.FILE_PATH+'/'+constants.FILE_NAME, 'w') as outputfile:
yaml.dump(data, outputfile, default_flow_style=False)

file = utility.set_yaml_state(constants.FILE_PATH+'/'+constants.FILE_NAME)
#TODO: check environment variable first before setting values into yaml file. If exist, then skip yaml update
openai_value = file['keys']['openai_token']
Expand Down
26 changes: 23 additions & 3 deletions mindmate/utils/utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
import yaml
import os
from mindmate.utils.conf import constants

class utility:
def create_yaml_state(file: str) -> dict:
while not os.path.isfile(constants.FILE_PATH+'/'+constants.FILE_NAME):
try:
os.makedirs(constants.FILE_PATH)
except FileExistsError as f:
pass
data = {
'version':1,
'keys': {
'openai_token':'xxxx',
'openai_id':'xxxx',
}
}
with open(constants.FILE_PATH+'/'+constants.FILE_NAME, 'w') as outputfile:
yaml.dump(data, outputfile, default_flow_style=False)
return data
def set_yaml_state(file: str) -> dict:
"""Read YAML file and return data as dictionary."""
with open(file, 'r') as f:
data_dict = yaml.load(f, Loader=yaml.FullLoader)
return data_dict
try:
with open(file, 'r') as f:
data_dict = yaml.load(f, Loader=yaml.FullLoader)
return data_dict
except FileNotFoundError as f:
return utility.create_yaml_state(file)
def update_yaml_state(state: dict, file_path: str) -> None:
"""update new yaml state with only changed keys and maintain unchanged values"""
with open(file_path, 'w') as outputfile:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
GITHUB_REPO = 'https://github.com/yalattas/mindmate'
setup(
name='mindmate',
version='0.0.2',
version='0.0.3',
author='Yasser Alattas',
author_email='y.alattas@gmail.com',
description="MindMate is a command-line tool that leverages the power of AI platforms to offer different use-cases to developers",
Expand Down

0 comments on commit 7f8c5ba

Please sign in to comment.