{"id":13635121,"url":"https://github.com/ConnectAI-E/Base-EasyWrite","last_synced_at":"2025-04-19T03:34:29.708Z","repository":{"id":181571102,"uuid":"666902410","full_name":"ConnectAI-E/Base-EasyWrite","owner":"ConnectAI-E","description":"🪖 实验项目 利用语音或者票据往多维表格录入数据","archived":false,"fork":false,"pushed_at":"2023-07-16T10:58:44.000Z","size":196,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-02T00:22:03.806Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ConnectAI-E.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-16T01:17:32.000Z","updated_at":"2023-07-24T14:31:52.000Z","dependencies_parsed_at":"2024-08-02T00:12:22.850Z","dependency_job_id":null,"html_url":"https://github.com/ConnectAI-E/Base-EasyWrite","commit_stats":null,"previous_names":["connectai-e/base-easywrite"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConnectAI-E%2FBase-EasyWrite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConnectAI-E%2FBase-EasyWrite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConnectAI-E%2FBase-EasyWrite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConnectAI-E%2FBase-EasyWrite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ConnectAI-E","download_url":"https://codeload.github.com/ConnectAI-E/Base-EasyWrite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223790246,"owners_count":17203353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T00:00:40.994Z","updated_at":"2024-11-09T05:30:23.348Z","avatar_url":"https://github.com/ConnectAI-E.png","language":"Go","funding_links":[],"categories":["多维表格"],"sub_categories":[],"readme":"# Base-EasyWrite\n🪖 实验项目 希望通过语音或票据信息，方便地向多维表格录入数据。\n\n## 最终效果\n\nhttps://github.com/ConnectAI-E/Base-EasyWrite/assets/50035229/2c1479d7-49c0-4c75-9bc9-14cece4bd13a\n\n\n## 真实场景+AI思路\n客户每天有海量的餐饮物资需要入库，但是手动的填写多维表格又非常麻烦\n\n (语音识别+图片OCR) x OpenAI的信息摘要能力 = 多模态的数据录入\n\n\n ```mermaid\nstateDiagram-v2\n    BOT --\u003e 语音录入\n    语音录入 --\u003e 飞书语音转文字\n    飞书语音转文字 --\u003e QA_FewShot\n    QA_FewShot --\u003e OpenAI_Summary\n    OpenAI_Summary --\u003e 操作指令_JSON\n    操作指令_JSON --\u003e 读写多维表格\n\n    BOT --\u003e 票据图片\n    票据图片 --\u003e 阿里云票据OCR\n    阿里云票据OCR --\u003e QA_FewShot\n\n    读取多维表格 --\u003e 获取已有数据库信息 \n    获取已有数据库信息 --\u003e QA_FewShot\n\n```\n\n## 项目核心的Prompt\n\nocr识别后\n```\nprompt := `下面是一些通过 OCR 识别图片生成的文字 【` + a.info.qParsed + `】，请整理返回 存货名称/品名/数量/金额/日期`\n```\n\n语音识别后\n```\nprompt := `你是仓库管理员,产品数据库有如下商品：【` + productNames + `】。供应商有：【` + suppliers + `】，你可以将下面的文本转换为json数组的入库记录单。\n\t下面是部分实例\n\t---\n\tQ: 【李峰供应商，送来吊龙三斤，总价143元】\n\tA: [{\n\t\t\t\"date\":` + today + `,\n\t\t\t\"productName\":\"吊龙\",\n\t\t\t\"companyName\":\"李峰\",\n\t\t\t\"totalNumber\":3,\n\t\t\t\"totalPrice\":143,\n\t\t}]\n\tQ:【3月23号，生菜4.2斤，12块6，平菇，1.1斤，5块5】\n\tA: [{\n\t\t\t\"date\":\"2023/03/23\",\n\t\t\t\"productName\": \"生菜\",\n\t\t\t\"companyName\":\"\",\n\t\t\t\"totalNumber\": 4.2,\n\t\t\t\"totalPrice\": 12.6\n\t\t},\n\t\t{\n\t\t\t\"date\":\"2023/03/23\",\n\t\t\t\"productName\": \"平菇\",\n\t\t\t\"companyName\":\"\",\n\t\t\t\"totalNumber\": 1.1,\n\t\t\t\"totalPrice\": 5.5\n\t\t}]\n\tQ: 【线下自购莲藕100斤 合计189元】\n\tA: [{\n\t\t\t\"date\":` + today + `,\n\t\t\t\"productName\":\"藕\",\n\t\t\t\"companyName\":\"线下自购\",\n\t\t\t\"totalNumber\":100,\n\t\t\t\"totalPrice\":189,\n\t\t}]\n\tQ: 【6月3日，供应商小军收入豆奶10瓶子 合计100元】\n\tA: [{\n\t\t\t\"date\":\"2023/06/03\",\n\t\t\t\"productName\":\"唯怡豆奶（塑框玻璃瓶）\",\n\t\t\t\"companyName\":\"小军\",\n\t\t\t\"totalNumber\":10,\n\t\t\t\"totalPrice\"'':100,\n\t\t}]\n\t----\n\t那么，Q:【` + content + `】 转换成json数组的入库单结果是什么？直接返回 json数组的代码，不要其他提示信息。 \n\t请注意：\n\t1. 如果没说明时间，那么 date 字段就是 UTC+8 的现在日期；\n\t2. 如果没说明年份，默认是` + strconv.Itoa(year) + `年，比如 3月23号，date 就是` + strconv.Itoa(year) + `/03/23；\n\t3. productName 根据产品数据库中的名称，对提供的信息进行转换，结果请从产品数据库中选择，比如提供的信息是 雪花超级勇闯(蓝Super X)，产品数据库中\n\t是 雪花超级勇闯（蓝SuperX），那么请返回 雪花超级勇闯（蓝SuperX）；\n\t4. companyName 请从供应商中选择，如果没有匹配的，companyName 为空字符串；\n\t5. 可能会出现部分错别字，比如把 “5斤” 写成 “5金”。`\n```\n\n## 复现部署\n1. 导入MVP环境的[多维表格至本地](https://fork-way.feishu.cn/base/Norqbd3anazOMlsceoEcbeIMn2g?table=tblghsq6TY3XktYG\u0026view=vewr4Kwn8O)\n2. 复制一份`config.yaml`文件，填写对应的配置\n    ```json5\n\t#飞书BOT配置\n\tAPP_ID: cli_a4172ca48e7b9013\n\tAPP_SECRET: tWFwzQNzkD..\n\tAPP_ENCRYPT_KEY: 39XCQUA00uqeDC..\n\tAPP_VERIFICATION_TOKEN: CYyoRCIz..\n\tBOT_NAME: ChatGPT\n\t\n\t# openai 配置\n\tOPENAI_MODEL: gpt-3.5-turbo\n\t# openAI 最大token数 默认为2000\n\tOPENAI_MAX_TOKENS: 2000\n\tOPENAI_KEY: sk-zTeWCJSr...\n\t\n\t# mvp多维表格 \n\tBITABLE_HOST: fork-way.feishu.cn\n\tBITABLE_APP_TOKEN: Norqbd3anazOMlsceoEcbeIMn2g\n\t#产品数据库tableID\n\tPRODUCT_BITABLE_ID: tblVY2JwWJfbzWzS\n\t#供应商tableID\n\tSUPPLIER_BITABlE_ID: tbltrRO7DJGXd1ZJ\n\t#目标写入tableID及其视图ID\n\tRECEIPT_BITABLE_ID: tblghsq6TY3XktYG\n\tRECEIPT_BITABLE_VIEW: vewr4Kwn8O\n\t\n\t# 阿里云 OCR https://ai.aliyun.com/ocr/invoice\n\tALI_ACCESSKEY_ID: LTAI5tEBvzfgfjZSy...\n\tALI_ACCESSKEY_SECRET: DxpKnI64q31630....\n\t\n\t# 服务器配置\n\tHTTP_PORT: 9001\n\tHTTPS_PORT: 9002\n\t\n\t```\n\n3. 此应用整体基于飞书-OpenAI项目改造完成，初[原项目配置](https://github.com/ConnectAI-E/Feishu-OpenAI#%E8%AF%A6%E7%BB%86%E9%85%8D%E7%BD%AE%E6%AD%A5%E9%AA%A4)之外，还需下列额外操作\n\t```\n\t事件权限-查看、评论、编辑和管理多维表格 \n\t进入多维表格-更多-添加文档应用-添加此应用\n\t```\n\u003cimg width=\"420\" alt=\"image\" src=\"https://github.com/ConnectAI-E/Base-EasyWrite/assets/50035229/d2c0511d-0df2-4e74-a3de-7e7a889f9d96\"\u003e\n\n4. 输入测试文本：`收到了大白菜 30斤 一共100块`\n\n## 下一步思考\n\n如何让数据录入的场景更加通用，从而减少定制化的需求呢？\n\n下一步一定是OA-Agent~\n\n以录入助手为例，其本身分为两个agent：\n```\n1.数据收集agent，作用：产生约定的json字段，他下辖\n- 语音收集agent -作用：自然语音--\u003e约定的json字段\n- 票据收集agent-作用：票据图片--\u003e约定的json字段\n2.多维表格录入agent，作用：自然语言或者约定的指令--\u003e读写多维表格\n```\n\n那我们在定制什么呢? 我们其实就在定制QA\n\n所有的Agent都接受QA作为历史学习经验的积累，才可以上岗\n\nAgent的学习方式现在看来至少包括：\n- 提示词 Prompt、\n- few-short的QA、\n- context-window向量索引上下文的QA\n- 利用Lora微调模型本身\n\n## 更多交流\n\u003cdiv align='left'\u003e\n   \u003cimg align=\"left\" src=\"https://github.com/ConnectAI-E/.github/assets/110169811/2c3cbe7d-6792-4fc2-9ddb-f21fbbdf8faf\" width=\"220\"/\u003e\n\u003c/div\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FConnectAI-E%2FBase-EasyWrite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FConnectAI-E%2FBase-EasyWrite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FConnectAI-E%2FBase-EasyWrite/lists"}