mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-23 02:27:14 +00:00
fix: modelscope no usable
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
<svg id="_层_2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 274.37 172.76"><defs><style>.cls-2{fill:#36cfd1}.cls-3{fill:#624aff}</style></defs><g id="_层_1-2"><path class="cls-3" d="M24.78 73.55h25.65V99.2H24.78zm99.14 25.66h25.65v25.65h-25.65zm76.95 25.65h-25.65v22.19h47.84V99.21h-22.19v25.65z"/><path class="cls-2" d="M149.57 73.55h25.65V99.2h-25.65zM24.78 47.9h25.65v25.65H24.78z"/><path class="cls-3" d="M223.06 73.55h25.65V99.2h-25.65z"/><path class="cls-2" d="M223.06 47.9h25.65v25.65h-25.65z"/><path class="cls-3" d="M175.22 25.71V47.9h25.65v25.65h22.19V25.71h-47.84z"/><path class="cls-2" d="M98.27 73.55h25.65V99.2H98.27z"/><path class="cls-3" d="M72.62 47.9h25.65V25.71H50.43v47.84h22.19V47.9zm0 51.31H50.43v47.84h47.84v-22.19H72.62V99.21z"/><path style="fill:none" d="M0 0h274.37v172.76H0z"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 820 B |
@@ -27,7 +27,7 @@ class ModelScopeChatCompletions(requester.LLMAPIRequester):
|
|||||||
async def initialize(self):
|
async def initialize(self):
|
||||||
self.client = openai.AsyncClient(
|
self.client = openai.AsyncClient(
|
||||||
api_key='',
|
api_key='',
|
||||||
base_url=self.requester_cfg['base-url'],
|
base_url=self.requester_cfg['base_url'],
|
||||||
timeout=self.requester_cfg['timeout'],
|
timeout=self.requester_cfg['timeout'],
|
||||||
http_client=httpx.AsyncClient(trust_env=True, timeout=self.requester_cfg['timeout']),
|
http_client=httpx.AsyncClient(trust_env=True, timeout=self.requester_cfg['timeout']),
|
||||||
)
|
)
|
||||||
@@ -125,14 +125,14 @@ class ModelScopeChatCompletions(requester.LLMAPIRequester):
|
|||||||
self,
|
self,
|
||||||
query: core_entities.Query,
|
query: core_entities.Query,
|
||||||
req_messages: list[dict],
|
req_messages: list[dict],
|
||||||
use_model: entities.LLMModelInfo,
|
use_model: requester.RuntimeLLMModel,
|
||||||
use_funcs: list[tools_entities.LLMFunction] = None,
|
use_funcs: list[tools_entities.LLMFunction] = None,
|
||||||
extra_args: dict[str, typing.Any] = {},
|
extra_args: dict[str, typing.Any] = {},
|
||||||
) -> llm_entities.Message:
|
) -> llm_entities.Message:
|
||||||
self.client.api_key = use_model.token_mgr.get_token()
|
self.client.api_key = use_model.token_mgr.get_token()
|
||||||
|
|
||||||
args = {}
|
args = {}
|
||||||
args['model'] = use_model.name if use_model.model_name is None else use_model.model_name
|
args['model'] = use_model.model_entity.name
|
||||||
|
|
||||||
if use_funcs:
|
if use_funcs:
|
||||||
tools = await self.ap.tool_mgr.generate_tools_for_openai(use_funcs)
|
tools = await self.ap.tool_mgr.generate_tools_for_openai(use_funcs)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ metadata:
|
|||||||
label:
|
label:
|
||||||
en_US: ModelScope
|
en_US: ModelScope
|
||||||
zh_CN: 魔搭社区
|
zh_CN: 魔搭社区
|
||||||
|
icon: modelscope.svg
|
||||||
spec:
|
spec:
|
||||||
config:
|
config:
|
||||||
- name: base_url
|
- name: base_url
|
||||||
|
|||||||
Reference in New Issue
Block a user