XThomasBU
commited on
Commit
·
ae33464
1
Parent(s):
60929fd
updates
Browse files
apps/ai_tutor/config/config_manager.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from pydantic import BaseModel,
|
| 2 |
from typing import Optional, List
|
| 3 |
import yaml
|
| 4 |
|
|
@@ -148,7 +148,7 @@ class ConfigManager:
|
|
| 148 |
|
| 149 |
def get_config(self) -> Config:
|
| 150 |
return ConfigWrapper(self.config)
|
| 151 |
-
|
| 152 |
def validate_config(self):
|
| 153 |
# If any required fields are missing, raise an error
|
| 154 |
# required_fields = [
|
|
|
|
| 1 |
+
from pydantic import BaseModel, conint, confloat, HttpUrl
|
| 2 |
from typing import Optional, List
|
| 3 |
import yaml
|
| 4 |
|
|
|
|
| 148 |
|
| 149 |
def get_config(self) -> Config:
|
| 150 |
return ConfigWrapper(self.config)
|
| 151 |
+
|
| 152 |
def validate_config(self):
|
| 153 |
# If any required fields are missing, raise an error
|
| 154 |
# required_fields = [
|
apps/ai_tutor/main.py
CHANGED
|
@@ -6,7 +6,6 @@ from config.constants import (
|
|
| 6 |
)
|
| 7 |
from modules.chat_processor.literal_ai import CustomLiteralDataLayer
|
| 8 |
import json
|
| 9 |
-
import yaml
|
| 10 |
from typing import Any, Dict, no_type_check
|
| 11 |
import chainlit as cl
|
| 12 |
from modules.chat.llm_tutor import LLMTutor
|
|
@@ -520,7 +519,7 @@ class Chatbot:
|
|
| 520 |
+ str(tokens_left)
|
| 521 |
+ "</span></footer>\n"
|
| 522 |
)
|
| 523 |
-
|
| 524 |
await cl.Message(
|
| 525 |
content=answer_with_sources,
|
| 526 |
elements=source_elements,
|
|
|
|
| 6 |
)
|
| 7 |
from modules.chat_processor.literal_ai import CustomLiteralDataLayer
|
| 8 |
import json
|
|
|
|
| 9 |
from typing import Any, Dict, no_type_check
|
| 10 |
import chainlit as cl
|
| 11 |
from modules.chat.llm_tutor import LLMTutor
|
|
|
|
| 519 |
+ str(tokens_left)
|
| 520 |
+ "</span></footer>\n"
|
| 521 |
)
|
| 522 |
+
|
| 523 |
await cl.Message(
|
| 524 |
content=answer_with_sources,
|
| 525 |
elements=source_elements,
|
apps/chainlit_base/chainlit_base.py
CHANGED
|
@@ -1,14 +1,11 @@
|
|
| 1 |
import chainlit.data as cl_data
|
| 2 |
import asyncio
|
| 3 |
-
import yaml
|
| 4 |
from typing import Any, Dict, no_type_check
|
| 5 |
import chainlit as cl
|
| 6 |
from modules.chat.llm_tutor import LLMTutor
|
| 7 |
from modules.chat.helpers import (
|
| 8 |
get_sources,
|
| 9 |
-
get_history_chat_resume,
|
| 10 |
get_history_setup_llm,
|
| 11 |
-
get_last_config,
|
| 12 |
)
|
| 13 |
import copy
|
| 14 |
import time
|
|
@@ -24,6 +21,7 @@ ERROR = "Error"
|
|
| 24 |
|
| 25 |
config = config_manager.get_config().dict()
|
| 26 |
|
|
|
|
| 27 |
class Chatbot:
|
| 28 |
def __init__(self, config):
|
| 29 |
"""
|
|
@@ -249,8 +247,6 @@ class Chatbot:
|
|
| 249 |
|
| 250 |
await self.make_llm_settings_widgets(self.config) # Reload the settings widgets
|
| 251 |
|
| 252 |
-
user = cl.user_session.get("user")
|
| 253 |
-
|
| 254 |
# TODO: remove self.user with cl.user_session.get("user")
|
| 255 |
self.user = {
|
| 256 |
"user_id": "guest",
|
|
|
|
| 1 |
import chainlit.data as cl_data
|
| 2 |
import asyncio
|
|
|
|
| 3 |
from typing import Any, Dict, no_type_check
|
| 4 |
import chainlit as cl
|
| 5 |
from modules.chat.llm_tutor import LLMTutor
|
| 6 |
from modules.chat.helpers import (
|
| 7 |
get_sources,
|
|
|
|
| 8 |
get_history_setup_llm,
|
|
|
|
| 9 |
)
|
| 10 |
import copy
|
| 11 |
import time
|
|
|
|
| 21 |
|
| 22 |
config = config_manager.get_config().dict()
|
| 23 |
|
| 24 |
+
|
| 25 |
class Chatbot:
|
| 26 |
def __init__(self, config):
|
| 27 |
"""
|
|
|
|
| 247 |
|
| 248 |
await self.make_llm_settings_widgets(self.config) # Reload the settings widgets
|
| 249 |
|
|
|
|
|
|
|
| 250 |
# TODO: remove self.user with cl.user_session.get("user")
|
| 251 |
self.user = {
|
| 252 |
"user_id": "guest",
|
apps/chainlit_base/config/config_manager.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from pydantic import BaseModel,
|
| 2 |
from typing import Optional, List
|
| 3 |
import yaml
|
| 4 |
|
|
@@ -134,7 +134,7 @@ class ConfigManager:
|
|
| 134 |
|
| 135 |
def get_config(self) -> Config:
|
| 136 |
return ConfigWrapper(self.config)
|
| 137 |
-
|
| 138 |
def validate_config(self):
|
| 139 |
# If any required fields are missing, raise an error
|
| 140 |
# required_fields = [
|
|
|
|
| 1 |
+
from pydantic import BaseModel, conint, confloat, HttpUrl
|
| 2 |
from typing import Optional, List
|
| 3 |
import yaml
|
| 4 |
|
|
|
|
| 134 |
|
| 135 |
def get_config(self) -> Config:
|
| 136 |
return ConfigWrapper(self.config)
|
| 137 |
+
|
| 138 |
def validate_config(self):
|
| 139 |
# If any required fields are missing, raise an error
|
| 140 |
# required_fields = [
|