Skip to content

Commit

Permalink
Проведена чистка директории, удалены лишние файлы
Browse files Browse the repository at this point in the history
  • Loading branch information
neurogen-dev committed Sep 17, 2023
1 parent e0b925f commit f5c54ba
Show file tree
Hide file tree
Showing 17 changed files with 16 additions and 244 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion backend.py → backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from flask_cors import CORS
from threading import Thread
import logging
from embedding_processing import embedding_processing
from .embedding_processing import embedding_processing

import g4f
from g4f import ChatCompletion, Provider, BaseProvider, models
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
81 changes: 0 additions & 81 deletions locale/en_US.json

This file was deleted.

27 changes: 0 additions & 27 deletions locale/extract_locale.py

This file was deleted.

86 changes: 0 additions & 86 deletions locale/ru_RU.json

This file was deleted.

24 changes: 9 additions & 15 deletions modules/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
import urllib3
import traceback
import pathlib
import re

import colorama
from duckduckgo_search import DDGS
from itertools import islice
from enum import Enum


from typing import Any, Optional
from typing import Any, Optional, Tuple, Generator

from langchain.callbacks.base import BaseCallbackHandler
from langchain.schema import AgentAction, AgentFinish

from threading import Condition
from collections import deque

Expand All @@ -32,26 +33,26 @@ def __init__(self):
self.cond = Condition()
self.finished = False

def callback(self, result):
def callback(self, result: str) -> None:
with self.cond:
self.queue.append(result)
self.cond.notify() # Wake up the generator.
self.cond.notify()

def __iter__(self):
return self

def __next__(self):
with self.cond:
while not self.queue and not self.finished: # Wait for a value to be added to the queue.
while not self.queue and not self.finished:
self.cond.wait()
if not self.queue:
if not self.queue:
raise StopIteration()
return self.queue.popleft()

def finish(self):
with self.cond:
self.finished = True
self.cond.notify() # Wake up the generator if it's waiting.
self.cond.notify()

def get_action_description(text):
match = re.search('```(.*?)```', text, re.S)
Expand All @@ -69,7 +70,6 @@ def get_action_description(text):
class ChuanhuCallbackHandler(BaseCallbackHandler):

def __init__(self, callback) -> None:
"""Initialize callback handler."""
self.callback = callback

def on_agent_action(
Expand Down Expand Up @@ -114,13 +114,7 @@ class ModelType(Enum):

@classmethod
def get_type(cls, model_name: str):
model_type = None
model_name_lower = model_name.lower()
if "gpt" in model_name_lower:
model_type = ModelType.OpenAI
else:
model_type = ModelType.OpenAI
return model_type
return ModelType.OpenAI if "gpt" in model_name.lower() else ModelType.Unknown


class BaseLLMModel:
Expand Down
26 changes: 0 additions & 26 deletions modules/webui_locale.py

This file was deleted.

4 changes: 2 additions & 2 deletions start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ python -c "import locale; print(locale.getdefaultlocale()[0])" > lang.txt
set /p language=<lang.txt

IF "%language%"=="ru_RU" (
python webui_ru.py
python webui\webui_ru.py
) ELSE (
python webui_en.py
python webui\webui_en.py
)

pause
2 changes: 1 addition & 1 deletion start_endpoint.bat
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ IF NOT EXIST venv\Lib\site-packages\ru_core_news_sm (
echo Completed.
echo Running NeuroGPT...

python endpoint.py
python backend\endpoint.py
pause
1 change: 0 additions & 1 deletion status.json

This file was deleted.

3 changes: 1 addition & 2 deletions webui_en.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
from modules.overwrites import *
from modules.models.models import get_model
import fastwsgi
from backend import app
from backend.backend import app

import threading
import time
import json
import random
import time

import backend
from multiprocessing import Process

import logging
Expand Down
4 changes: 2 additions & 2 deletions webui_ru.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import gradio as gr
import asyncio
import fastwsgi

import aiohttp
from aiohttp import web
Expand All @@ -15,8 +16,7 @@
from modules.presets import *
from modules.overwrites import *
from modules.models.models import get_model
import fastwsgi
from backend import app
from backend.backend import app


import threading
Expand Down

0 comments on commit f5c54ba

Please sign in to comment.