Skip to content

Commit

Permalink
feat(Agent): ChatAgent And AgentHub
Browse files Browse the repository at this point in the history
1.Upgrade sqlalchemy to version 2.0
yhjun1026 committed Oct 18, 2023
1 parent b06dbe3 commit ac4b809
Showing 34 changed files with 210 additions and 20 deletions.
2 changes: 0 additions & 2 deletions pilot/base_modules/agent/db/my_plugin_db.py
Original file line number Diff line number Diff line change
@@ -3,8 +3,6 @@
from sqlalchemy import Column, Integer, String, Index, DateTime, func
from sqlalchemy import UniqueConstraint

from pilot.base_modules.meta_data.meta_data import Base

from pilot.base_modules.meta_data.base_dao import BaseDao
from pilot.base_modules.meta_data.meta_data import Base, engine, session

2 changes: 1 addition & 1 deletion pilot/base_modules/agent/hub/agent_hub.py
Original file line number Diff line number Diff line change
@@ -180,7 +180,7 @@ async def upload_my_plugin(self, doc_file: UploadFile, user: Any = Default_User)
os.remove(file_path)
tmp_fd, tmp_path = tempfile.mkstemp(dir=os.path.join(self.plugin_dir))
with os.fdopen(tmp_fd, "wb") as tmp:
tmp.write(await doc_file.read())
await tmp.write(await doc_file.read())
shutil.move(
tmp_path,
os.path.join(self.plugin_dir, doc_file.filename),
Empty file.
2 changes: 1 addition & 1 deletion pilot/memory/chat_history/store_type/meta_db_history.py
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ def conv_info(self, conv_uid: str = None) -> None:
return chat_history.__dict__

def get_messages(self) -> List[OnceConversation]:
logger.info("get_messages:{}", self.chat_seesion_id)
# logger.info("get_messages:{}", self.chat_seesion_id)
chat_history = self.chat_history_dao.get_by_uid(self.chat_seesion_id)
if chat_history:
context = chat_history.messages
6 changes: 3 additions & 3 deletions pilot/meta_data/alembic/env.py
Original file line number Diff line number Diff line change
@@ -40,9 +40,9 @@ def run_migrations_offline() -> None:
script output.
"""
url = str(engine.url)
url = config.get_main_option("sqlalchemy.url")
context.configure(
url=url,
url="'mysql+pymysql://root:aa123456@127.0.0.1:3306/dbgpt'",
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
@@ -65,7 +65,7 @@ def run_migrations_online() -> None:
poolclass=pool.NullPool,
)

with connectable.connect() as connection:
with engine.connect() as connection:
if engine.dialect.name == "sqlite":
context.configure(
connection=engine.connect(),
2 changes: 1 addition & 1 deletion pilot/server/base.py
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ def server_init(args, system_app: SystemApp):
cfg = Config()
cfg.SYSTEM_APP = system_app

# ddl_init_and_upgrade()
ddl_init_and_upgrade()

# load_native_plugins(cfg)
signal.signal(signal.SIGINT, signal_handler)
2 changes: 1 addition & 1 deletion pilot/server/static/404.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pilot/server/static/404/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

173 changes: 173 additions & 0 deletions pilot/server/static/_next/static/chunks/pages/_app-fdf09e227ecb3ffc.js

Large diffs are not rendered by default.

Loading
Oops, something went wrong.

0 comments on commit ac4b809

Please sign in to comment.