Skip to main content

ChatArch Feishu/Lark bot helpers extracted from ChatTool.

Project description

ChatLark

ChatArch 的 Feishu/Lark bot helper 包,承接从 ChatTool 拆出的轻量机器人、消息发送、事件服务和消息内容构造能力。更广泛的 Feishu/Lark OpenAPI 操作仍优先使用官方 lark-cli

快速开始

pip install -e ".[dev]"
chatlark --help
chatlark --version
chatlark send --help
chatlark serve --help
python -m pytest -q
python -m build

CLI

chatlark info
chatlark send USER_ID "Hello"
chatlark send "Hello"                  # 使用 FEISHU_DEFAULT_RECEIVER_ID
chatlark send -t chat_id "Hello team" # 使用 FEISHU_DEFAULT_CHAT_ID
chatlark serve echo
chatlark serve webhook

AI 对话命令保留为可选边界,避免 ChatLark 基础包依赖 ChatTool 形成循环:

pip install "chatlark[llm]"
chatlark chat
chatlark serve ai --system "你是工作助手"

Python API

from chatlark import LarkBot, ChatSession

bot = LarkBot()
session = ChatSession(system="你是助手")

@bot.on_message
def chat(ctx):
    ctx.reply(session.chat(ctx.sender_id, ctx.text))

bot.start()

配置

ChatLark 复用 ChatEnv 的 Feishu 配置字段:

  • FEISHU_APP_ID
  • FEISHU_APP_SECRET
  • FEISHU_API_BASE
  • FEISHU_DEFAULT_RECEIVER_ID
  • FEISHU_DEFAULT_CHAT_ID

可通过环境变量直接提供,也可以通过 -e/--env 指定 ChatEnv Feishu profile 或 .env 文件。

边界

  • ChatLark:bot helper、消息发送、事件服务、消息上下文、消息内容构造。
  • lark-cli:广泛 Feishu/Lark OpenAPI 操作和用户授权流程。
  • ChatTool:迁移完成后只应保留有意设计的兼容入口或依赖连接,不再重复持有 Lark business logic。

开发说明

扩展前先阅读 DEVELOP.mdAGENTS.md。发布走 PyPI Trusted Publisher/OIDC workflow,不使用本地 token 上传正式版本。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chatlark-0.1.0.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chatlark-0.1.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file chatlark-0.1.0.tar.gz.

File metadata

  • Download URL: chatlark-0.1.0.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for chatlark-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d3a250062957ab5f3180450cc6fc8e388f0d06e0192f9bb8160037b98d5c728a
MD5 c47301263439b74f0640725a41d2e538
BLAKE2b-256 a9a403aa66ce3719bdae75d63296b7f929cf058b15522c5e5babe4ff409c8d93

See more details on using hashes here.

Provenance

The following attestation bundles were made for chatlark-0.1.0.tar.gz:

Publisher: publish.yml on ChatArch/ChatLark

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chatlark-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chatlark-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for chatlark-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dad4b0450e13b8d8fb83570c4918a0be2063ae662cb43995fc97834716257c42
MD5 517ed5eef77d6ba49441b3f68dea3c87
BLAKE2b-256 2b2e317dcbce32c9cb7aad95ee168ce4c2404ebec155c76339b44d258e8b94ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for chatlark-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ChatArch/ChatLark

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page