mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-09 23:36:02 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13e29a9966 | ||
|
|
601b0a8964 | ||
|
|
7c2ceb0aca | ||
|
|
42fabd5133 | ||
|
|
210a8856e2 | ||
|
|
c531cb11af | ||
|
|
07e073f526 |
16
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
16
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@@ -3,22 +3,6 @@ description: 报错或漏洞请使用这个模板创建,不使用此模板创
|
|||||||
title: "[Bug]: "
|
title: "[Bug]: "
|
||||||
labels: ["bug?"]
|
labels: ["bug?"]
|
||||||
body:
|
body:
|
||||||
- type: dropdown
|
|
||||||
attributes:
|
|
||||||
label: 消息平台适配器
|
|
||||||
description: "接入的消息平台类型"
|
|
||||||
options:
|
|
||||||
- 其他(或暂未使用)
|
|
||||||
- Nakuru(go-cqhttp)
|
|
||||||
- aiocqhttp(使用 OneBot 协议接入的)
|
|
||||||
- qq-botpy(QQ官方API WebSocket)
|
|
||||||
- qqofficial(QQ官方API Webhook)
|
|
||||||
- lark(飞书)
|
|
||||||
- wecom(企业微信)
|
|
||||||
- gewechat(个人微信)
|
|
||||||
- discord
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: 运行环境
|
label: 运行环境
|
||||||
|
|||||||
@@ -343,7 +343,6 @@ class LarkAdapter(adapter.MessagePlatformAdapter):
|
|||||||
type = context.header.event_type
|
type = context.header.event_type
|
||||||
|
|
||||||
if 'url_verification' == type:
|
if 'url_verification' == type:
|
||||||
print(data.get("challenge"))
|
|
||||||
# todo 验证verification token
|
# todo 验证verification token
|
||||||
return {
|
return {
|
||||||
"challenge": data.get("challenge")
|
"challenge": data.get("challenge")
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class TelegramEventConverter(adapter.EventConverter):
|
|||||||
time=event.message.date.timestamp(),
|
time=event.message.date.timestamp(),
|
||||||
source_platform_object=event
|
source_platform_object=event
|
||||||
)
|
)
|
||||||
elif event.effective_chat.type == 'group':
|
elif event.effective_chat.type == 'group' or 'supergroup' :
|
||||||
return platform_events.GroupMessage(
|
return platform_events.GroupMessage(
|
||||||
sender=platform_entities.GroupMember(
|
sender=platform_entities.GroupMember(
|
||||||
id=event.effective_chat.id,
|
id=event.effective_chat.id,
|
||||||
@@ -202,9 +202,12 @@ class TelegramAdapter(adapter.MessagePlatformAdapter):
|
|||||||
|
|
||||||
for component in components:
|
for component in components:
|
||||||
if component['type'] == 'text':
|
if component['type'] == 'text':
|
||||||
content = telegramify_markdown.markdownify(
|
if self.config['markdown_card'] is True:
|
||||||
content= component['text'],
|
content = telegramify_markdown.markdownify(
|
||||||
)
|
content= component['text'],
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
content = component['text']
|
||||||
args = {
|
args = {
|
||||||
"chat_id": message_source.source_platform_object.effective_chat.id,
|
"chat_id": message_source.source_platform_object.effective_chat.id,
|
||||||
"text": content,
|
"text": content,
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import openai
|
import openai
|
||||||
|
|
||||||
from . import chatcmpl
|
from . import chatcmpl, modelscopechatcmpl
|
||||||
from .. import requester
|
from .. import requester
|
||||||
from ....core import app
|
from ....core import app
|
||||||
|
|
||||||
|
|
||||||
class BailianChatCompletions(chatcmpl.OpenAIChatCompletions):
|
class BailianChatCompletions(modelscopechatcmpl.ModelScopeChatCompletions):
|
||||||
"""阿里云百炼大模型平台 ChatCompletion API 请求器"""
|
"""阿里云百炼大模型平台 ChatCompletion API 请求器"""
|
||||||
|
|
||||||
client: openai.AsyncClient
|
client: openai.AsyncClient
|
||||||
@@ -18,3 +18,4 @@ class BailianChatCompletions(chatcmpl.OpenAIChatCompletions):
|
|||||||
self.ap = ap
|
self.ap = ap
|
||||||
|
|
||||||
self.requester_cfg = self.ap.provider_cfg.data['requester']['bailian-chat-completions']
|
self.requester_cfg = self.ap.provider_cfg.data['requester']['bailian-chat-completions']
|
||||||
|
|
||||||
@@ -61,6 +61,12 @@ class OpenAIChatCompletions(requester.LLMAPIRequester):
|
|||||||
if 'role' not in chatcmpl_message or chatcmpl_message['role'] is None:
|
if 'role' not in chatcmpl_message or chatcmpl_message['role'] is None:
|
||||||
chatcmpl_message['role'] = 'assistant'
|
chatcmpl_message['role'] = 'assistant'
|
||||||
|
|
||||||
|
reasoning_content = chatcmpl_message['reasoning_content'] if 'reasoning_content' in chatcmpl_message else None
|
||||||
|
|
||||||
|
# deepseek的reasoner模型
|
||||||
|
if reasoning_content is not None:
|
||||||
|
chatcmpl_message['content'] = "<think>\n" + reasoning_content + "\n</think>\n\n"+ chatcmpl_message['content']
|
||||||
|
|
||||||
message = llm_entities.Message(**chatcmpl_message)
|
message = llm_entities.Message(**chatcmpl_message)
|
||||||
|
|
||||||
return message
|
return message
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ class MoonshotChatCompletions(chatcmpl.OpenAIChatCompletions):
|
|||||||
if 'content' in m and isinstance(m["content"], list):
|
if 'content' in m and isinstance(m["content"], list):
|
||||||
m["content"] = " ".join([c["text"] for c in m["content"]])
|
m["content"] = " ".join([c["text"] for c in m["content"]])
|
||||||
|
|
||||||
# 删除空的
|
# 删除空的,不知道干嘛的,直接删了。
|
||||||
messages = [m for m in messages if m["content"].strip() != ""]
|
# messages = [m for m in messages if m["content"].strip() != "" and ('tool_calls' not in m or not m['tool_calls'])]
|
||||||
|
|
||||||
args["messages"] = messages
|
args["messages"] = messages
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
semantic_version = "v3.4.13"
|
semantic_version = "v3.4.13.1"
|
||||||
|
|
||||||
debug_mode = False
|
debug_mode = False
|
||||||
|
|
||||||
|
|||||||
@@ -37,4 +37,5 @@ mcp
|
|||||||
slack_sdk
|
slack_sdk
|
||||||
telegramify-markdown
|
telegramify-markdown
|
||||||
# indirect
|
# indirect
|
||||||
taskgroup==0.0.0a4
|
taskgroup==0.0.0a4
|
||||||
|
python-socks
|
||||||
Reference in New Issue
Block a user