diff --git a/pkg/command/cmdmgr.py b/pkg/command/cmdmgr.py index a9feafd..530a717 100644 --- a/pkg/command/cmdmgr.py +++ b/pkg/command/cmdmgr.py @@ -3,8 +3,8 @@ from __future__ import annotations import typing from ..core import app, entities as core_entities -from ..gai import entities as llm_entities -from ..gai.session import entities as session_entities +from ..provider import entities as llm_entities +from ..provider.session import entities as session_entities from . import entities, operator, errors from .operators import func, plugin, default, reset, list as list_cmd, last, next, delc, resend, prompt, cfg, cmd, help, version, update diff --git a/pkg/command/entities.py b/pkg/command/entities.py index 98312bd..7e6ff54 100644 --- a/pkg/command/entities.py +++ b/pkg/command/entities.py @@ -6,7 +6,7 @@ import pydantic import mirai from ..core import app, entities as core_entities -from ..gai.session import entities as session_entities +from ..provider.session import entities as session_entities from . import errors, operator diff --git a/pkg/command/operator.py b/pkg/command/operator.py index 299bb6c..c5529ce 100644 --- a/pkg/command/operator.py +++ b/pkg/command/operator.py @@ -4,7 +4,7 @@ import typing import abc from ..core import app, entities as core_entities -from ..gai.session import entities as session_entities +from ..provider.session import entities as session_entities from . import entities diff --git a/pkg/core/app.py b/pkg/core/app.py index 9fd2830..3768d37 100644 --- a/pkg/core/app.py +++ b/pkg/core/app.py @@ -3,11 +3,11 @@ from __future__ import annotations import logging import asyncio -from ..im import manager as qqbot_mgr -from ..gai.session import sessionmgr as llm_session_mgr -from ..gai.requester import modelmgr as llm_model_mgr -from ..gai.sysprompt import sysprompt as llm_prompt_mgr -from ..gai.tools import toolmgr as llm_tool_mgr +from ..platform import manager as qqbot_mgr +from ..provider.session import sessionmgr as llm_session_mgr +from ..provider.requester import modelmgr as llm_model_mgr +from ..provider.sysprompt import sysprompt as llm_prompt_mgr +from ..provider.tools import toolmgr as llm_tool_mgr from ..config import manager as config_mgr from ..database import manager as database_mgr from ..utils.center import v2 as center_mgr diff --git a/pkg/core/boot.py b/pkg/core/boot.py index 9153573..9bebc52 100644 --- a/pkg/core/boot.py +++ b/pkg/core/boot.py @@ -14,11 +14,11 @@ from . import controller from ..pipeline import stagemgr from ..audit import identifier from ..database import manager as db_mgr -from ..gai.session import sessionmgr as llm_session_mgr -from ..gai.requester import modelmgr as llm_model_mgr -from ..gai.sysprompt import sysprompt as llm_prompt_mgr -from ..gai.tools import toolmgr as llm_tool_mgr -from ..im import manager as im_mgr +from ..provider.session import sessionmgr as llm_session_mgr +from ..provider.requester import modelmgr as llm_model_mgr +from ..provider.sysprompt import sysprompt as llm_prompt_mgr +from ..provider.tools import toolmgr as llm_tool_mgr +from ..platform import manager as im_mgr from ..command import cmdmgr from ..plugin import host as plugin_host from ..utils.center import v2 as center_v2 diff --git a/pkg/pipeline/process/handlers/chat.py b/pkg/pipeline/process/handlers/chat.py index a7ac9f0..4c7b136 100644 --- a/pkg/pipeline/process/handlers/chat.py +++ b/pkg/pipeline/process/handlers/chat.py @@ -7,7 +7,7 @@ import mirai from .. import handler from ... import entities from ....core import entities as core_entities -from ....gai import entities as llm_entities +from ....provider import entities as llm_entities class ChatMessageHandler(handler.MessageHandler): diff --git a/pkg/gai/api/__init__.py b/pkg/platform/__init__.py similarity index 100% rename from pkg/gai/api/__init__.py rename to pkg/platform/__init__.py diff --git a/pkg/im/adapter.py b/pkg/platform/adapter.py similarity index 100% rename from pkg/im/adapter.py rename to pkg/platform/adapter.py diff --git a/pkg/im/manager.py b/pkg/platform/manager.py similarity index 95% rename from pkg/im/manager.py rename to pkg/platform/manager.py index f6c8efe..e088954 100644 --- a/pkg/im/manager.py +++ b/pkg/platform/manager.py @@ -10,11 +10,11 @@ from mirai import At, GroupMessage, MessageEvent, StrangerMessage, \ import mirai import func_timeout -from ..gai import session as openai_session +from ..provider import session as openai_session from ..utils import context import tips as tips_custom -from ..im import adapter as msadapter +from ..platform import adapter as msadapter from .ratelim import ratelim from ..core import app, entities as core_entities @@ -44,13 +44,13 @@ class QQBotManager: logging.debug("Use adapter:" + config['msg_source_adapter']) if config['msg_source_adapter'] == 'yirimirai': - from pkg.im.sources.yirimirai import YiriMiraiAdapter + from pkg.platform.sources.yirimirai import YiriMiraiAdapter mirai_http_api_config = config['mirai_http_api_config'] self.bot_account_id = config['mirai_http_api_config']['qq'] self.adapter = YiriMiraiAdapter(mirai_http_api_config) elif config['msg_source_adapter'] == 'nakuru': - from pkg.im.sources.nakuru import NakuruProjectAdapter + from pkg.platform.sources.nakuru import NakuruProjectAdapter self.adapter = NakuruProjectAdapter(config['nakuru_config']) self.bot_account_id = self.adapter.bot_account_id diff --git a/pkg/gai/requester/__init__.py b/pkg/platform/ratelim/__init__.py similarity index 100% rename from pkg/gai/requester/__init__.py rename to pkg/platform/ratelim/__init__.py diff --git a/pkg/im/ratelim/algo.py b/pkg/platform/ratelim/algo.py similarity index 100% rename from pkg/im/ratelim/algo.py rename to pkg/platform/ratelim/algo.py diff --git a/pkg/gai/requester/apis/__init__.py b/pkg/platform/ratelim/algos/__init__.py similarity index 100% rename from pkg/gai/requester/apis/__init__.py rename to pkg/platform/ratelim/algos/__init__.py diff --git a/pkg/im/ratelim/algos/fixedwin.py b/pkg/platform/ratelim/algos/fixedwin.py similarity index 100% rename from pkg/im/ratelim/algos/fixedwin.py rename to pkg/platform/ratelim/algos/fixedwin.py diff --git a/pkg/im/ratelim/ratelim.py b/pkg/platform/ratelim/ratelim.py similarity index 100% rename from pkg/im/ratelim/ratelim.py rename to pkg/platform/ratelim/ratelim.py diff --git a/pkg/gai/session/__init__.py b/pkg/platform/sources/__init__.py similarity index 100% rename from pkg/gai/session/__init__.py rename to pkg/platform/sources/__init__.py diff --git a/pkg/im/sources/nakuru.py b/pkg/platform/sources/nakuru.py similarity index 99% rename from pkg/im/sources/nakuru.py rename to pkg/platform/sources/nakuru.py index f0df866..46e0ee5 100644 --- a/pkg/im/sources/nakuru.py +++ b/pkg/platform/sources/nakuru.py @@ -9,7 +9,7 @@ import nakuru import nakuru.entities.components as nkc from .. import adapter as adapter_model -from ...im import blob +from ...platform import blob from ...utils import context diff --git a/pkg/im/sources/yirimirai.py b/pkg/platform/sources/yirimirai.py similarity index 100% rename from pkg/im/sources/yirimirai.py rename to pkg/platform/sources/yirimirai.py diff --git a/pkg/plugin/host.py b/pkg/plugin/host.py index 5e9ec9d..11602cf 100644 --- a/pkg/plugin/host.py +++ b/pkg/plugin/host.py @@ -15,7 +15,7 @@ from ..utils import network as network from ..utils import context as context from ..plugin import switch as switch from ..plugin import settings as settings -from ..im import adapter as msadapter +from ..platform import adapter as msadapter from ..plugin import metadata as metadata from mirai import Mirai diff --git a/pkg/gai/__init__.py b/pkg/provider/__init__.py similarity index 100% rename from pkg/gai/__init__.py rename to pkg/provider/__init__.py diff --git a/pkg/gai/sysprompt/__init__.py b/pkg/provider/api/__init__.py similarity index 100% rename from pkg/gai/sysprompt/__init__.py rename to pkg/provider/api/__init__.py diff --git a/pkg/gai/api/chat_completion.py b/pkg/provider/api/chat_completion.py similarity index 100% rename from pkg/gai/api/chat_completion.py rename to pkg/provider/api/chat_completion.py diff --git a/pkg/gai/api/completion.py b/pkg/provider/api/completion.py similarity index 100% rename from pkg/gai/api/completion.py rename to pkg/provider/api/completion.py diff --git a/pkg/gai/api/model.py b/pkg/provider/api/model.py similarity index 100% rename from pkg/gai/api/model.py rename to pkg/provider/api/model.py diff --git a/pkg/gai/entities.py b/pkg/provider/entities.py similarity index 100% rename from pkg/gai/entities.py rename to pkg/provider/entities.py diff --git a/pkg/gai/modelmgr.py b/pkg/provider/modelmgr.py similarity index 96% rename from pkg/gai/modelmgr.py rename to pkg/provider/modelmgr.py index 69e64be..f4bf69d 100644 --- a/pkg/gai/modelmgr.py +++ b/pkg/provider/modelmgr.py @@ -8,9 +8,9 @@ Completion - text-davinci-003 等模型 import tiktoken import openai -from ..gai.api import model as api_model -from ..gai.api import completion as api_completion -from ..gai.api import chat_completion as api_chat_completion +from ..provider.api import model as api_model +from ..provider.api import completion as api_completion +from ..provider.api import chat_completion as api_chat_completion COMPLETION_MODELS = { "gpt-3.5-turbo-instruct", diff --git a/pkg/gai/sysprompt/loaders/__init__.py b/pkg/provider/requester/__init__.py similarity index 100% rename from pkg/gai/sysprompt/loaders/__init__.py rename to pkg/provider/requester/__init__.py diff --git a/pkg/gai/requester/api.py b/pkg/provider/requester/api.py similarity index 100% rename from pkg/gai/requester/api.py rename to pkg/provider/requester/api.py diff --git a/pkg/gai/tools/__init__.py b/pkg/provider/requester/apis/__init__.py similarity index 100% rename from pkg/gai/tools/__init__.py rename to pkg/provider/requester/apis/__init__.py diff --git a/pkg/gai/requester/apis/chatcmpl.py b/pkg/provider/requester/apis/chatcmpl.py similarity index 100% rename from pkg/gai/requester/apis/chatcmpl.py rename to pkg/provider/requester/apis/chatcmpl.py diff --git a/pkg/gai/requester/entities.py b/pkg/provider/requester/entities.py similarity index 100% rename from pkg/gai/requester/entities.py rename to pkg/provider/requester/entities.py diff --git a/pkg/gai/requester/modelmgr.py b/pkg/provider/requester/modelmgr.py similarity index 100% rename from pkg/gai/requester/modelmgr.py rename to pkg/provider/requester/modelmgr.py diff --git a/pkg/gai/requester/token.py b/pkg/provider/requester/token.py similarity index 100% rename from pkg/gai/requester/token.py rename to pkg/provider/requester/token.py diff --git a/pkg/im/__init__.py b/pkg/provider/session/__init__.py similarity index 100% rename from pkg/im/__init__.py rename to pkg/provider/session/__init__.py diff --git a/pkg/gai/session/entities.py b/pkg/provider/session/entities.py similarity index 100% rename from pkg/gai/session/entities.py rename to pkg/provider/session/entities.py diff --git a/pkg/gai/session/sessionmgr.py b/pkg/provider/session/sessionmgr.py similarity index 100% rename from pkg/gai/session/sessionmgr.py rename to pkg/provider/session/sessionmgr.py diff --git a/pkg/im/ratelim/__init__.py b/pkg/provider/sysprompt/__init__.py similarity index 100% rename from pkg/im/ratelim/__init__.py rename to pkg/provider/sysprompt/__init__.py diff --git a/pkg/gai/sysprompt/entities.py b/pkg/provider/sysprompt/entities.py similarity index 85% rename from pkg/gai/sysprompt/entities.py rename to pkg/provider/sysprompt/entities.py index af19025..31ca199 100644 --- a/pkg/gai/sysprompt/entities.py +++ b/pkg/provider/sysprompt/entities.py @@ -3,7 +3,7 @@ from __future__ import annotations import typing import pydantic -from ...gai import entities +from ...provider import entities class Prompt(pydantic.BaseModel): diff --git a/pkg/gai/sysprompt/loader.py b/pkg/provider/sysprompt/loader.py similarity index 100% rename from pkg/gai/sysprompt/loader.py rename to pkg/provider/sysprompt/loader.py diff --git a/pkg/im/ratelim/algos/__init__.py b/pkg/provider/sysprompt/loaders/__init__.py similarity index 100% rename from pkg/im/ratelim/algos/__init__.py rename to pkg/provider/sysprompt/loaders/__init__.py diff --git a/pkg/gai/sysprompt/loaders/scenario.py b/pkg/provider/sysprompt/loaders/scenario.py similarity index 95% rename from pkg/gai/sysprompt/loaders/scenario.py rename to pkg/provider/sysprompt/loaders/scenario.py index e0991ca..917de48 100644 --- a/pkg/gai/sysprompt/loaders/scenario.py +++ b/pkg/provider/sysprompt/loaders/scenario.py @@ -5,7 +5,7 @@ import os from .. import loader from .. import entities -from ....gai import entities as llm_entities +from ....provider import entities as llm_entities class ScenarioPromptLoader(loader.PromptLoader): diff --git a/pkg/gai/sysprompt/loaders/single.py b/pkg/provider/sysprompt/loaders/single.py similarity index 96% rename from pkg/gai/sysprompt/loaders/single.py rename to pkg/provider/sysprompt/loaders/single.py index 9a3df6b..0b10963 100644 --- a/pkg/gai/sysprompt/loaders/single.py +++ b/pkg/provider/sysprompt/loaders/single.py @@ -3,7 +3,7 @@ import os from .. import loader from .. import entities -from ....gai import entities as llm_entities +from ....provider import entities as llm_entities class SingleSystemPromptLoader(loader.PromptLoader): diff --git a/pkg/gai/sysprompt/sysprompt.py b/pkg/provider/sysprompt/sysprompt.py similarity index 100% rename from pkg/gai/sysprompt/sysprompt.py rename to pkg/provider/sysprompt/sysprompt.py diff --git a/pkg/im/sources/__init__.py b/pkg/provider/tools/__init__.py similarity index 100% rename from pkg/im/sources/__init__.py rename to pkg/provider/tools/__init__.py diff --git a/pkg/gai/tools/entities.py b/pkg/provider/tools/entities.py similarity index 100% rename from pkg/gai/tools/entities.py rename to pkg/provider/tools/entities.py diff --git a/pkg/gai/tools/toolmgr.py b/pkg/provider/tools/toolmgr.py similarity index 100% rename from pkg/gai/tools/toolmgr.py rename to pkg/provider/tools/toolmgr.py