gabykim commited on
Commit
5549c3e
·
1 Parent(s): 886e734

fix gradio chatbot

Browse files
src/know_lang_bot/chat_bot/__main__.py CHANGED
@@ -1,10 +1,10 @@
1
- from know_lang_bot.chat_bot.chat_config import chat_app_config
2
  from know_lang_bot.chat_bot.chat_graph import process_chat
3
  import chromadb
4
  import asyncio
5
 
6
  async def test_chat_processing():
7
- config = chat_app_config
8
  db_client = chromadb.PersistentClient(
9
  path=str(config.db.persist_directory)
10
  )
 
1
+ from know_lang_bot.config import AppConfig
2
  from know_lang_bot.chat_bot.chat_graph import process_chat
3
  import chromadb
4
  import asyncio
5
 
6
  async def test_chat_processing():
7
+ config = AppConfig()
8
  db_client = chromadb.PersistentClient(
9
  path=str(config.db.persist_directory)
10
  )
src/know_lang_bot/chat_bot/chat_interface.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
- from know_lang_bot.chat_bot.chat_config import ChatAppConfig, chat_app_config
3
  from know_lang_bot.utils.fancy_log import FancyLogger
4
  from know_lang_bot.chat_bot.chat_graph import ChatResult, process_chat
5
  import chromadb
@@ -10,7 +10,7 @@ from pathlib import Path
10
  LOG = FancyLogger(__name__)
11
 
12
  class CodeQAChatInterface:
13
- def __init__(self, config: ChatAppConfig):
14
  self.config = config
15
  self._init_chroma()
16
  self.codebase_dir = Path(config.db.codebase_directory)
@@ -117,6 +117,6 @@ class CodeQAChatInterface:
117
 
118
  return interface
119
 
120
- def create_chatbot() -> gr.Blocks:
121
- interface = CodeQAChatInterface(chat_app_config)
122
  return interface.create_interface()
 
1
  import gradio as gr
2
+ from know_lang_bot.config import AppConfig
3
  from know_lang_bot.utils.fancy_log import FancyLogger
4
  from know_lang_bot.chat_bot.chat_graph import ChatResult, process_chat
5
  import chromadb
 
10
  LOG = FancyLogger(__name__)
11
 
12
  class CodeQAChatInterface:
13
+ def __init__(self, config: AppConfig):
14
  self.config = config
15
  self._init_chroma()
16
  self.codebase_dir = Path(config.db.codebase_directory)
 
117
 
118
  return interface
119
 
120
+ def create_chatbot(config: AppConfig) -> gr.Blocks:
121
+ interface = CodeQAChatInterface(config)
122
  return interface.create_interface()
src/know_lang_bot/chat_bot/gradio_demo.py CHANGED
@@ -1,4 +1,7 @@
1
  from know_lang_bot.chat_bot.chat_interface import create_chatbot
 
2
 
3
- demo = create_chatbot()
 
 
4
  demo.launch()
 
1
  from know_lang_bot.chat_bot.chat_interface import create_chatbot
2
+ from know_lang_bot.config import AppConfig
3
 
4
+
5
+ config = AppConfig()
6
+ demo = create_chatbot(config)
7
  demo.launch()