Skip to content

Commit

Permalink
Merge branch 'main' into tylertitsworth/md
Browse files Browse the repository at this point in the history
  • Loading branch information
tylertitsworth committed Jan 4, 2024
2 parents 5d3d90a + 243f72f commit 444495f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/linters/.python-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[MESSAGES CONTROL]
disable=redefined-outer-name, no-member, missing-function-docstring, import-error, line-too-long, missing-module-docstring, redefined-builtin, missing-class-docstring, global-variable-not-assigned, protected-access, attribute-defined-outside-init
20 changes: 9 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from sys import exit
from collections import namedtuple

import argparse
import chainlit as cl
import yaml
import torch

from collections import namedtuple
from chainlit.input_widget import Slider, TextInput
from chainlit.playground.config import add_llm_provider
from langchain.cache import SQLiteCache
Expand Down Expand Up @@ -33,8 +33,8 @@ def __init__(self):
except FileNotFoundError:
print("Error: File config.yaml not found.")
exit(1)
except yaml.YAMLError as e:
print(f"Error reading YAML file: {e}")
except yaml.YAMLError as err:
print(f"Error reading YAML file: {err}")
exit(1)
self.convert_struct(**data)

Expand All @@ -49,18 +49,16 @@ def convert_struct(self, **kwargs):
def set_args(self, args):
self.args = args

def set_chat_settings(self, settings):
# Update global wiki, not local self
global wiki
if isinstance(settings, dict):
for key, val in settings.items():
setattr(wiki, key, val)


# Globals
wiki = MultiWiki()


def set_chat_settings(settings):
if isinstance(settings, dict):
for key, val in settings.items():
setattr(wiki, key, val)

def rename_duplicates(documents):
document_counts = {}

Expand Down Expand Up @@ -155,7 +153,7 @@ def create_chain():


async def update_cl(settings):
wiki.set_chat_settings(settings)
set_chat_settings(settings)
chain = create_chain()
# https://docs.chainlit.io/api-reference/chat-settings
inputs = [
Expand Down
1 change: 1 addition & 0 deletions provider.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: skip-file
from typing import List, Union

from chainlit.input_widget import InputWidget
Expand Down
6 changes: 3 additions & 3 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
def pytest_addoption(parser):
for marker, info in optional_markers.items():
parser.addoption(
"--{}".format(marker), action="store_true", default=False, help=info["help"]
f"--{marker}", action="store_true", default=False, help=info["help"]
)


def pytest_configure(config):
for marker, info in optional_markers.items():
config.addinivalue_line(
"markers", "{}: {}".format(marker, info["marker-descr"])
"markers", f"{marker}: {info['marker-descr']}"
)


def pytest_collection_modifyitems(config, items):
for marker, info in optional_markers.items():
if not config.getoption("--{}".format(marker)):
if not config.getoption(f"--{marker}"):
skip_test = pytest.mark.skip(reason=info["skip-reason"].format(marker))
for item in items:
if marker in item.keywords:
Expand Down

0 comments on commit 444495f

Please sign in to comment.