mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-14 21:52:56 +08:00
Compare commits
2 Commits
7b36f864ef
...
5bc5feca78
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bc5feca78 | ||
|
|
3afedc8e3c |
@ -7,6 +7,8 @@ from nonebot_plugin_session import EventSession
|
|||||||
|
|
||||||
from zhenxun.configs.config import Config
|
from zhenxun.configs.config import Config
|
||||||
from zhenxun.configs.utils import PluginExtraData, RegisterConfig
|
from zhenxun.configs.utils import PluginExtraData, RegisterConfig
|
||||||
|
from zhenxun.services.llm.config.providers import get_llm_config
|
||||||
|
from zhenxun.services.llm.manager import clear_model_cache
|
||||||
from zhenxun.services.log import logger
|
from zhenxun.services.log import logger
|
||||||
from zhenxun.utils.enum import PluginType
|
from zhenxun.utils.enum import PluginType
|
||||||
from zhenxun.utils.message import MessageUtils
|
from zhenxun.utils.message import MessageUtils
|
||||||
@ -54,6 +56,8 @@ _matcher = on_alconna(
|
|||||||
@_matcher.handle()
|
@_matcher.handle()
|
||||||
async def _(session: EventSession, arparma: Arparma):
|
async def _(session: EventSession, arparma: Arparma):
|
||||||
Config.reload()
|
Config.reload()
|
||||||
|
get_llm_config.cache_clear()
|
||||||
|
clear_model_cache()
|
||||||
logger.debug("自动重载配置文件", arparma.header_result, session=session)
|
logger.debug("自动重载配置文件", arparma.header_result, session=session)
|
||||||
await MessageUtils.build_message("重载完成!").send(reply_to=True)
|
await MessageUtils.build_message("重载完成!").send(reply_to=True)
|
||||||
|
|
||||||
@ -65,4 +69,6 @@ async def _(session: EventSession, arparma: Arparma):
|
|||||||
async def _():
|
async def _():
|
||||||
if Config.get_config("reload_setting", "AUTO_RELOAD"):
|
if Config.get_config("reload_setting", "AUTO_RELOAD"):
|
||||||
Config.reload()
|
Config.reload()
|
||||||
|
get_llm_config.cache_clear()
|
||||||
|
clear_model_cache()
|
||||||
logger.debug("已自动重载配置文件...")
|
logger.debug("已自动重载配置文件...")
|
||||||
|
|||||||
@ -119,8 +119,7 @@ class GeminiAdapter(BaseAdapter):
|
|||||||
system_instruction_parts = [{"text": msg.content}]
|
system_instruction_parts = [{"text": msg.content}]
|
||||||
elif isinstance(msg.content, list):
|
elif isinstance(msg.content, list):
|
||||||
system_instruction_parts = [
|
system_instruction_parts = [
|
||||||
await converter.convert_part(part)
|
await converter.convert_part(part) for part in msg.content
|
||||||
for part in msg.content
|
|
||||||
]
|
]
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
@ -302,7 +302,6 @@ async def _generate_image_from_message(
|
|||||||
messages = await normalize_to_llm_messages(message)
|
messages = await normalize_to_llm_messages(message)
|
||||||
|
|
||||||
async with await get_model_instance(model) as model_instance:
|
async with await get_model_instance(model) as model_instance:
|
||||||
|
|
||||||
response = await model_instance.generate_response(messages, config=config)
|
response = await model_instance.generate_response(messages, config=config)
|
||||||
|
|
||||||
if not response.images:
|
if not response.images:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user