Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

基于飞书知识库撰写、渲染并托管官网文档 #160

Open
Leizhenpeng opened this issue Jan 30, 2024 — with GitMaya App · 7 comments
Open

基于飞书知识库撰写、渲染并托管官网文档 #160

Leizhenpeng opened this issue Jan 30, 2024 — with GitMaya App · 7 comments
Assignees

Comments

Copy link
Member

No description provided.

@Leizhenpeng Leizhenpeng changed the title 基于飞书云文档内容撰写、渲染并托管官网文档 基于飞书知识库撰写、渲染并托管官网文档 Jan 30, 2024
Copy link
Member

Dogtiti commented Jan 30, 2024

八点左右

Copy link
Member Author

ok

@Leizhenpeng Leizhenpeng pinned this issue Feb 1, 2024
@Leizhenpeng
Copy link
Member Author

@Dogtiti 进度如何

Copy link
Member

Dogtiti commented Feb 18, 2024

这个还没有具体弄呢。年前在弄gpts那边

Copy link
Member Author

技术先调研一下,下周二下午看看可行性

Copy link
Member Author

加入飞书日程: https://www.feishu.cn/calendar/share?token=e8438056a23f199ea7587d7b13d29dfd
日程主题: MayaDoc 技术调研
时间: 2024年2月20日(周二) 15:30 - 16:00 (GMT+8)
组织者: 雷圳鹏

@freeziyou
Copy link
Contributor

freeziyou commented Feb 22, 2024

方案

  1. 前端选一个基于markdown的文档站点
  2. 后端使用一个定时脚本将飞书知识库按节点层级导出成markdown文件
  3. 然后重新编译部署前端站点

前端站点选型
@Dogtiti
https://github.com/ConnectAI-E/GitMaya-Website/tree/main/docs
之前的站点就可以用 按照pages下docs目录解析就行

数据结构
@freeziyou
文档现已支持 40 多种 Block 类型。你可参考本文档中 BlockType 枚举一节了解具体的 Block 类型。
文档块数据结构比较复杂,超出了markdown的格式,第一期只处理一些基本的
text
heading1 -> heading9
bullet
ordered
code
quote
image
table

{
    "block_id": string,                   /// 块的唯一标识。创建块时会自动生成
    "block_type": enum(BlockType),       /// 块的枚举值,表示块的类型
    "parent_id": string,                 /// 块的父块 ID。除了根节点 Page 块外,其余块均有父块
    "children": [](string),              /// 块的子块 ID 列表
    "comment_ids": [](string),           /// 文档的评论 ID 列表。查询评论内容参考「获取回复」接口
    /// 以下为支持的 Block 类型及其对应的内容实体(即 BlockData),如 Text、Image、Table 等。 
    /// 每种类型的 Block 都有一个对应的 BlockData,并且需与 BlockType 相对应。 
    "page": object(Text)                /// 页面(根) Block
    "text": object(Text),               /// 文本 Block
    "heading1": object(Text),           /// 一级标题 Block
    "heading2": object(Text),           /// 二级标题 Block
    "heading3": object(Text),           /// 三级标题 Block
    "heading4": object(Text),           /// 四级标题 Block
    "heading5": object(Text),           /// 五级标题 Block
    "heading6": object(Text),           /// 六级标题 Block
    "heading7": object(Text),           /// 七级标题 Block
    "heading8": object(Text),           /// 八级标题 Block
    "heading9": object(Text),           /// 九级标题 Block
    "bullet": object(Text),             /// 无序列表 Block
    "ordered": object(Text),            /// 有序列表 Block
    "code": object(Text),               /// 代码块 Block
    "quote": object(Text),              /// 引用 Block
    "todo": object(Text),               /// 待办事项 Block
    "bitable": object(Bitable),         /// 多维表格 Block
    "callout": object(Callout),         /// 高亮块 Block
    "chat_card": object(ChatCard),      /// 会话卡片 Block
    "diagram": object(Diagram),         /// 流程图 & UML 图 Block
    "divider": object(Divider),         /// 分割线 Block
    "file": object(File),               /// 文件 Block
    "grid": object(Grid),               /// 分栏 Block
    "grid_column": object(GridColumn),  /// 分栏列 Block
    "iframe": object(Iframe),           /// 内嵌 Block
    "image": object(Image),             /// 图片 Block
    "isv": object(ISV),                 /// 开放平台小组件 Block
    "mindnote": object(Mindnote),       /// 思维笔记 Block
    "sheet": object(Sheet),             /// 电子表格 Block
    "table": object(Table),             /// 表格 Block
    "table_cell": object(TableCell),    /// 表格单元格 Block
    "view": object(View),               /// 视图 Block
    "undefined": object(Undefined),     /// 未定义 Block
    "quote_container": object(QuoteContainer),       /// 引用容器 Block
    "task": object(Task),               /// 任务 Block
    "okr": object(OKR),                 /// OKR Block
    "okr_objective": object(OkrObjective),          /// OKR 目标 Block
    "okr_key_result": object(OkrKeyResult),         /// OKR 关键结果 Block
    "okr_progress": object(OkrProgress),            /// OKR 进展 Block
    "add_ons": object(AddOns),                      /// 文档小组件 Block
    "jira_issue": object(JiraIssue),                /// Jira 问题 Block
    "wiki_catalog": object(WikiCatalog),            /// Wiki 子目录 Block
    "board": object(Board)             /// 画板 Block
}

脚本

  1. 文档接口支持机器人访问或者用户(user_access_token)访问
    image

  2. 所以可以使用自建机器人 ,或者给一个飞书这边oauth拿到,并刷新user_access_token使用。
    自建机器人自己的租户就能用
    user_access_token这个可以使用商店应用,然后用户通过oauth授权登录,后面就直接使用这个用户身份访问

https://github.com/ConnectAI-E/awesome-feishu
image

可参考项目
@Dogtiti @Leizhenpeng
https://github.com/dicarne/feishu-backup

附录
https://open.feishu.cn/document/server-docs/docs/docs/docx-v1/document/list
文档块数据结构 https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-v1/data-structure/block

@freeziyou freeziyou self-assigned this Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants