Compare commits

...

3 Commits

Author SHA1 Message Date
Junyan Qin 4011a302af chore: bump version 4.6.0b2 for testing 2025-11-16 19:28:52 +08:00
Junyan Qin deb725a2e2 fix: send adapters and requesters icons 2025-11-16 19:26:30 +08:00
Junyan Qin 33eb866660 chore: add templates/** 2025-11-16 19:20:43 +08:00
6 changed files with 18 additions and 8 deletions
+2 -3
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "langbot" name = "langbot"
version = "4.6.0-beta.1" version = "4.6.0-beta.2"
description = "Easy-to-use global IM bot platform designed for LLM era" description = "Easy-to-use global IM bot platform designed for LLM era"
readme = "README.md" readme = "README.md"
license-files = ["LICENSE"] license-files = ["LICENSE"]
@@ -46,7 +46,6 @@ dependencies = [
"urllib3>=2.4.0", "urllib3>=2.4.0",
"websockets>=15.0.1", "websockets>=15.0.1",
"python-socks>=2.7.1", # dingtalk missing dependency "python-socks>=2.7.1", # dingtalk missing dependency
"taskgroup==0.0.0a4", # graingert/taskgroup#20
"pip>=25.1.1", "pip>=25.1.1",
"ruff>=0.11.9", "ruff>=0.11.9",
"pre-commit>=4.2.0", "pre-commit>=4.2.0",
@@ -108,7 +107,7 @@ requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[tool.setuptools] [tool.setuptools]
package-data = { "langbot" = ["templates/*", "pkg/provider/modelmgr/requesters/*", "pkg/platform/sources/*", "web/out/**"] } package-data = { "langbot" = ["templates/**", "pkg/provider/modelmgr/requesters/*", "pkg/platform/sources/*", "web/out/**"] }
[dependency-groups] [dependency-groups]
dev = [ dev = [
+1 -1
View File
@@ -1,3 +1,3 @@
"""LangBot - Easy-to-use global IM bot platform designed for LLM era""" """LangBot - Easy-to-use global IM bot platform designed for LLM era"""
__version__ = '4.6.0-beta.1' __version__ = '4.6.0-beta.2'
@@ -1,6 +1,7 @@
import quart import quart
import mimetypes
from ... import group from ... import group
from langbot.pkg.utils import importutil
@group.group_class('adapters', '/api/v1/platform/adapters') @group.group_class('adapters', '/api/v1/platform/adapters')
@@ -31,4 +32,6 @@ class AdaptersRouterGroup(group.RouterGroup):
if icon_path is None: if icon_path is None:
return self.http_status(404, -1, 'icon not found') return self.http_status(404, -1, 'icon not found')
return await quart.send_file(icon_path) return quart.Response(
importutil.read_resource_file_bytes(icon_path), mimetype=mimetypes.guess_type(icon_path)[0]
)
@@ -1,6 +1,8 @@
import quart import quart
import mimetypes
from ... import group from ... import group
from langbot.pkg.utils import importutil
@group.group_class('provider/requesters', '/api/v1/provider/requesters') @group.group_class('provider/requesters', '/api/v1/provider/requesters')
@@ -32,4 +34,6 @@ class RequestersRouterGroup(group.RouterGroup):
if icon_path is None: if icon_path is None:
return self.http_status(404, -1, 'icon not found') return self.http_status(404, -1, 'icon not found')
return await quart.send_file(icon_path) return quart.Response(
importutil.read_resource_file_bytes(icon_path), mimetype=mimetypes.guess_type(icon_path)[0]
)
+1 -1
View File
@@ -1,4 +1,4 @@
semantic_version = 'v4.6.0-beta.1' semantic_version = 'v4.6.0-beta.2'
required_database_version = 11 required_database_version = 11
"""Tag the version of the database schema, used to check if the database needs to be migrated""" """Tag the version of the database schema, used to check if the database needs to be migrated"""
+4
View File
@@ -41,5 +41,9 @@ def read_resource_file(resource_path: str) -> str:
return f.read() return f.read()
def read_resource_file_bytes(resource_path: str) -> bytes:
return importlib.resources.files('langbot').joinpath(resource_path).read_bytes()
def list_resource_files(resource_path: str) -> list[str]: def list_resource_files(resource_path: str) -> list[str]:
return [f.name for f in importlib.resources.files('langbot').joinpath(resource_path).iterdir()] return [f.name for f in importlib.resources.files('langbot').joinpath(resource_path).iterdir()]