From b31e62a5c6b0aaef8f891b31395b539a63d977a7 Mon Sep 17 00:00:00 2001 From: yingying Date: Mon, 18 Nov 2024 16:38:42 +0800 Subject: [PATCH 1/2] chore: rename Peter Cat to PeterCat --- LICENSE | 2 +- README.en-US.md | 10 +++++----- README.ja-JP.md | 4 ++-- README.md | 8 ++++---- assistant/README.md | 2 +- assistant/src/mock/bot.mock.ts | 2 +- client/.kiwi/en/DeployBotModal.ts | 4 ++-- client/.kiwi/en/app.ts | 7 +++---- client/.kiwi/en/edit.ts | 2 +- client/.kiwi/ja/app.ts | 2 +- client/.kiwi/ja/edit.ts | 2 +- client/.kiwi/ko/DeployBotModal.ts | 4 ++-- client/.kiwi/ko/app.ts | 2 +- client/.kiwi/ko/edit.ts | 2 +- client/.kiwi/zh-CN/DeployBotModal.ts | 4 ++-- client/.kiwi/zh-CN/app.ts | 4 ++-- client/.kiwi/zh-CN/edit.ts | 2 +- client/.kiwi/zh-TW/DeployBotModal.ts | 4 ++-- client/.kiwi/zh-TW/app.ts | 4 ++-- client/.kiwi/zh-TW/edit.ts | 2 +- client/app/layout.tsx | 4 ++-- client/app/page.tsx | 4 ++-- 22 files changed, 40 insertions(+), 41 deletions(-) diff --git a/LICENSE b/LICENSE index 6b460691..8df1ce9a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Peter Cat +Copyright (c) 2023 PeterCat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.en-US.md b/README.en-US.md index 7de084fe..5e460138 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -1,7 +1,7 @@ image -# Peter Cat +# PeterCat
@@ -29,7 +29,7 @@ We provide a conversational Q&A agent configuration system, self-hosted deployme ### Chatting means creating -You only need to provide the address or name of your repository, and Peter Cat will automatically complete the entire process of creating a bot. +You only need to provide the address or name of your repository, and PeterCat will automatically complete the entire process of creating a bot. ![Create with Conversations](https://mdn.alipayobjects.com/huamei_j8gzmo/afts/img/A*aQ9uRoNZGe8AAAAAAAAAAAAADrPSAQ/original) @@ -135,7 +135,7 @@ The project requires environment variables to be set: ## 🤝 Contributing -> Peter Cat uses yarn as the package manager. +> PeterCat uses yarn as the package manager. ```bash git clone https://github.com/petercat-ai/petercat.git @@ -178,7 +178,7 @@ Please send your project address, usage scenarios, usage frequency, and other in ## 📧 Reporting Issues -Peter Cat is still in its growth stage, and occasional “tantrums” are to be expected. Please report issues via the following channels: +PeterCat is still in its growth stage, and occasional “tantrums” are to be expected. Please report issues via the following channels: * [Submit an Issue(https://github.com/petercat-ai/petercat/issues/new/choose) * [Discussions](https://github.com/petercat-ai/petercat/discussions) @@ -193,4 +193,4 @@ Peter Cat is still in its growth stage, and occasional “tantrums” are to be ## 📄 License -MIT@[Peter Cat](https://github.com/petercat-ai/petercat/blob/main/LICENSE) +MIT@[PeterCat](https://github.com/petercat-ai/petercat/blob/main/LICENSE) diff --git a/README.ja-JP.md b/README.ja-JP.md index 60f1df77..04d95209 100644 --- a/README.ja-JP.md +++ b/README.ja-JP.md @@ -1,7 +1,7 @@ image -# Peter Cat +# PeterCat
@@ -172,4 +172,4 @@ Peter Catはまだ成長段階にあり、時折「癇癪」を起こすこと ## 📄 ライセンス -MIT@[Peter Cat](https://github.com/petercat-ai/petercat/blob/main/LICENSE) +MIT@[PeterCat](https://github.com/petercat-ai/petercat/blob/main/LICENSE) diff --git a/README.md b/README.md index 21262d9d..dab965bd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![banner](https://mdn.alipayobjects.com/huamei_j8gzmo/afts/img/A*m23lS7sVRDgAAAAAAAAAAAAADrPSAQ/original) -

Peter Cat

+

PeterCat

@@ -29,7 +29,7 @@ ### 对话即创造 -仅需要告知你的仓库地址或名称,Peter Cat 即可自动完成创建机器人的全部流程 +仅需要告知你的仓库地址或名称,PeterCat 即可自动完成创建机器人的全部流程 ![对话即创造](https://mdn.alipayobjects.com/huamei_j8gzmo/afts/img/A*aQ9uRoNZGe8AAAAAAAAAAAAADrPSAQ/original) @@ -143,7 +143,7 @@ ## 🤝 参与贡献 -> Peter Cat 使用 yarn 作为包管理器 +> PeterCat 使用 yarn 作为包管理器 ```bash git clone https://github.com/petercat-ai/petercat.git @@ -204,4 +204,4 @@ yarn run publish:pypi ## 📄 License -MIT@[Peter Cat](https://github.com/petercat-ai/petercat/blob/main/LICENSE) +MIT@[PeterCat](https://github.com/petercat-ai/petercat/blob/main/LICENSE) diff --git a/assistant/README.md b/assistant/README.md index 47ae792d..0e52669b 100644 --- a/assistant/README.md +++ b/assistant/README.md @@ -3,7 +3,7 @@ [![npm](https://img.shields.io/npm/dm/petercatai/chat-sdk.svg)](https://www.npmjs.com/package/petercatai/chat-sdk) [![Version](https://img.shields.io/npm/v/petercatai/chat-sdk/latest.svg)](https://www.npmjs.com/package/petercatai/chat-sdk) -chat-app is a UI component library based on dumi, designed for building [Peter Cat](https://petercat.ai) conversation interfaces. +chat-app is a UI component library based on dumi, designed for building [PeterCat](https://petercat.ai) conversation interfaces. ## Development diff --git a/assistant/src/mock/bot.mock.ts b/assistant/src/mock/bot.mock.ts index c7c24f34..25f25176 100644 --- a/assistant/src/mock/bot.mock.ts +++ b/assistant/src/mock/bot.mock.ts @@ -3,7 +3,7 @@ export const BOT_INFO = { 'https://mdn.alipayobjects.com/huamei_yhboz9/afts/img/A*li7ySppF7TYAAAAAAAAAAAAADlDCAQ/original', name: 'peterCat', helloMessage: - '👋🏻 你好,我是 Peter Cat 初次见面,先自我介绍一下:我是一个开源项目的机器人。你可以通过和我对话配置一个答疑机器人。下面是一些快捷选项,你可以选择开始配置!', //开场白 + '👋🏻 你好,我是 PeterCat 初次见面,先自我介绍一下:我是一个开源项目的机器人。你可以通过和我对话配置一个答疑机器人。下面是一些快捷选项,你可以选择开始配置!', //开场白 starters: [ '答疑机器人需要完成哪几步的配置?', '帮我创建一个 Ant Design 答疑机器人', diff --git a/client/.kiwi/en/DeployBotModal.ts b/client/.kiwi/en/DeployBotModal.ts index 0e301666..fd69ffa1 100644 --- a/client/.kiwi/en/DeployBotModal.ts +++ b/client/.kiwi/en/DeployBotModal.ts @@ -15,10 +15,10 @@ export default { shenHeZhong: 'Under review...', buShuDaoWoDe: 'Deploy to my website', zheJiangTiJiaoYi: - 'This will submit an issue to the Peter Cat repository, which can be completed after our manual review.', + 'This will submit an issue to the PeterCat repository, which can be completed after our manual review.', ninDeJiQiRen: 'Your robot has been made public in the marketplace, please check it out in the market.', - gongKaiDaoPE: 'Publish to the Peter Cat Marketplace', + gongKaiDaoPE: 'Publish to the PeterCat Marketplace', }, DeployItem: { shouQi: 'Collapse', diff --git a/client/.kiwi/en/app.ts b/client/.kiwi/en/app.ts index 6611c9c6..2eb70580 100644 --- a/client/.kiwi/en/app.ts +++ b/client/.kiwi/en/app.ts @@ -2,11 +2,10 @@ export default { page: { woMenLaiZiMa: 'We are from the Ant Group AFX Department, committed to creating beautiful and practical products. AI is just a means, and our only goal is to bring more pleasure and value for your work.', - xiangMuXiangXiXin: - 'Please check the documentation for more details', + xiangMuXiangXiXin: 'Please check the documentation for more details', chaKanGengDuo: 'Learn more', maYiKaiYuan: 'Ant Open Source', - pETER: 'Peter Cat Community', + pETER: 'PeterCat Community', liaoJieGengDuo: 'Learn more', deYiYuQiangDa: 'Based on powerful LLM abilities, you can convert any code repository of interest into a Q&A bot or experience other bots in the community. They can not only recommend high-quality code repositories but also assist users submit issues automatically.', @@ -17,7 +16,7 @@ export default { 'After creating the bot, all related GitHub documents and issues will be automatically stored as the knowledge base for the bot.', zhiShiZiDongRu: 'Knowledge import automation', jinXuYaoGaoZhi: - 'You only need to provide your repository address or name, and Peter Cat will automatically complete the entire process of creating a bot.', + 'You only need to provide your repository address or name, and PeterCat will automatically complete the entire process of creating a bot.', duiHuaJiChuangZao: 'Chatting means creating', woMenTiGongDui: 'We provide a conversational Q&A agent configuration system, self-hosted deployment solutions, and a convenient integrated application SDK, allowing you to create a smart Q&A bot for your GitHub repository with one click and quickly integrate it into various websites or projects, providing a more efficient technical support ecosystem for the community.', diff --git a/client/.kiwi/en/edit.ts b/client/.kiwi/en/edit.ts index 04f98ba6..3c9c2a66 100644 --- a/client/.kiwi/en/edit.ts +++ b/client/.kiwi/en/edit.ts @@ -15,7 +15,7 @@ export default { gITHU: 'GitHub Project Address', bangWoPeiZhiYi: 'Help me configure a Q&A bot', chuCiJianMianXian: - 'Nice to meet you. Let me introduce myself: I am a bot for an open-source project. You can configure a Q&A bot through conversation with me.', + '👋🏻 Hello! Nice to meet you. Let me introduce myself: I am PeterCat, a robot for an open-source project. You can configure a Q&A robot by talking to me.', shengChengShiBai: 'Generation Failed', shengChengChengGongE: 'Generation Successful', baoCunShiBaiE: 'Save Failed', diff --git a/client/.kiwi/ja/app.ts b/client/.kiwi/ja/app.ts index 83fbb443..de084687 100644 --- a/client/.kiwi/ja/app.ts +++ b/client/.kiwi/ja/app.ts @@ -5,7 +5,7 @@ export default { xiangMuXiangXiXin: 'プロジェクトの詳細情報はドキュメントでご確認ください', chaKanGengDuo: 'もっと見る', maYiKaiYuan: 'アントオープンソース', - pETER: 'Peter Cat コミュニティ', + pETER: 'PeterCat コミュニティ', liaoJieGengDuo: '詳細を知る', deYiYuQiangDa: '強力な基盤により、気になるコードリポジトリをQ&Aボットに変換したり、他のコミュニティボットを体験できます。これらは優れたコードリポジトリを推薦するだけでなく、ユーザーが自動的にissueを提出するのも支援します。', diff --git a/client/.kiwi/ja/edit.ts b/client/.kiwi/ja/edit.ts index 7f4760c9..47a082a3 100644 --- a/client/.kiwi/ja/edit.ts +++ b/client/.kiwi/ja/edit.ts @@ -15,7 +15,7 @@ export default { gITHU: 'GitHubプロジェクトのアドレス', bangWoPeiZhiYi: 'Q&Aボットの設定を手伝ってください', chuCiJianMianXian: - 'はじめまして、私はオープンソースプロジェクトのボットです。私との対話を通じてQ&Aボットを設定できます。', + '👋🏻 こんにちは!初めまして、自己紹介させていただきます。私はPeterCatと申します。オープンソースプロジェクトのロボットです。私と対話することで、Q&Aロボットを設定できます。', shengChengShiBai: '生成に失敗しました', shengChengChengGongE: '生成に成功しました', baoCunShiBaiE: '保存に失敗しました', diff --git a/client/.kiwi/ko/DeployBotModal.ts b/client/.kiwi/ko/DeployBotModal.ts index f95f01c5..445c5f5e 100644 --- a/client/.kiwi/ko/DeployBotModal.ts +++ b/client/.kiwi/ko/DeployBotModal.ts @@ -13,9 +13,9 @@ export default { shenHeZhong: '검토 중...', buShuDaoWoDe: '내 웹사이트에 배포', zheJiangTiJiaoYi: - '이것은 Peter Cat 저장소에 issue를 제출하게 되며, 우리 인공 검토를 통과하면 공개될 수 있습니다.', + '이것은 PeterCat 저장소에 issue를 제출하게 되며, 우리 인공 검토를 통과하면 공개될 수 있습니다.', ninDeJiQiRen: '당신의 봇이 시장에 공개되었습니다. 시장을 확인해 보세요.', - gongKaiDaoPE: 'Peter Cat 시장에 공개', + gongKaiDaoPE: 'PeterCat 시장에 공개', }, DeployItem: { shouQi: '접기', diff --git a/client/.kiwi/ko/app.ts b/client/.kiwi/ko/app.ts index 3e5b1e1f..3102e88b 100644 --- a/client/.kiwi/ko/app.ts +++ b/client/.kiwi/ko/app.ts @@ -5,7 +5,7 @@ export default { xiangMuXiangXiXin: '프로젝트의 자세한 정보는 문서를 참조하십시오.', chaKanGengDuo: '더 보기', maYiKaiYuan: '앤트 오픈소스', - pETER: 'Peter Cat 커뮤니티', + pETER: 'PeterCat 커뮤니티', liaoJieGengDuo: '더 알아보기', deYiYuQiangDa: '강력한 기본 능력 덕분에 관심 있는 코드 저장소를 Q&A 봇으로 전환하거나 커뮤니티의 다른 봇을 체험할 수 있습니다. 이들은 우수한 코드 저장소를 추천할 뿐만 아니라 사용자가 issue를 자동으로 제출할 수 있도록 도와줍니다.', diff --git a/client/.kiwi/ko/edit.ts b/client/.kiwi/ko/edit.ts index b4f36efc..77405ca0 100644 --- a/client/.kiwi/ko/edit.ts +++ b/client/.kiwi/ko/edit.ts @@ -15,7 +15,7 @@ export default { gITHU: 'GitHub 프로젝트 주소', bangWoPeiZhiYi: 'Q&A 봇 설정을 도와주세요.', chuCiJianMianXian: - '처음 뵙겠습니다, 저는 오픈 소스 프로젝트 봇입니다. 저와 대화를 통해 Q&A 봇을 설정할 수 있습니다.', + '👋🏻 안녕하세요! 처음 뵙겠습니다. 제 소개를 하겠습니다: 저는 PeterCat입니다, 오픈소스 프로젝트의 로봇입니다. 저와 대화를 통해 질의응답 로봇을 구성할 수 있습니다.', shengChengShiBai: '생성 실패', shengChengChengGongE: '생성 성공', baoCunShiBaiE: '저장 실패', diff --git a/client/.kiwi/zh-CN/DeployBotModal.ts b/client/.kiwi/zh-CN/DeployBotModal.ts index 91b7be9e..3dcb1a86 100644 --- a/client/.kiwi/zh-CN/DeployBotModal.ts +++ b/client/.kiwi/zh-CN/DeployBotModal.ts @@ -13,9 +13,9 @@ export default { shenHeZhong: '审核中...', buShuDaoWoDe: '部署到我的网站', zheJiangTiJiaoYi: - '这将提交一个 issue 到 Peter Cat\n 仓库,待我们人工审核通过后即可完成公开。', + '这将提交一个 issue 到 PeterCat\n 仓库,待我们人工审核通过后即可完成公开。', ninDeJiQiRen: '您的机器人已经公开到了市场,请前往市场查看。', - gongKaiDaoPE: '公开到 Peter Cat 市场', + gongKaiDaoPE: '公开到 PeterCat 市场', }, DeployItem: { shouQi: '收起', diff --git a/client/.kiwi/zh-CN/app.ts b/client/.kiwi/zh-CN/app.ts index b760799c..608c96d0 100644 --- a/client/.kiwi/zh-CN/app.ts +++ b/client/.kiwi/zh-CN/app.ts @@ -5,7 +5,7 @@ export default { xiangMuXiangXiXin: '项目详细信息请进文档查阅', chaKanGengDuo: '查看更多', maYiKaiYuan: '蚂蚁开源', - pETER: 'Peter Cat 社区', + pETER: 'PeterCat 社区', liaoJieGengDuo: '了解更多', deYiYuQiangDa: '得益于强大的底层能力,您可以将任意感兴趣的代码仓库转换为答疑机器人,或体验社区中其它机器人。它们不仅能推荐优质代码仓库,还能协助用户自动提交\n issue。', @@ -16,7 +16,7 @@ export default { '机器人创建后,所有相关Github 文档和 issue\n 将自动入库,作为机器人的知识依据', zhiShiZiDongRu: '知识自动入库', jinXuYaoGaoZhi: - '仅需要告知你的仓库地址或名称,Peter Cat\n 即可自动完成创建机器人的全部流程', + '仅需要告知你的仓库地址或名称,PeterCat\n 即可自动完成创建机器人的全部流程', duiHuaJiChuangZao: '对话即创造', woMenTiGongDui: '我们提供对话式答疑 Agent\n 配置系统、自托管部署方案和便捷的一体化应用\n SDK,让您能够为自己的 GitHub\n 仓库一键创建智能答疑机器人,并快速集成到各类官网或项目中,\n 为社区提供更高效的技术支持生态。', diff --git a/client/.kiwi/zh-CN/edit.ts b/client/.kiwi/zh-CN/edit.ts index 1df8890a..9742212f 100644 --- a/client/.kiwi/zh-CN/edit.ts +++ b/client/.kiwi/zh-CN/edit.ts @@ -14,7 +14,7 @@ export default { gITHU: 'Github 项目地址', bangWoPeiZhiYi: '帮我配置一个答疑机器人', chuCiJianMianXian: - '初次见面,先自我介绍一下:我是一个开源项目的机器人。你可以通过和我对话配置一个答疑机器人。', + '👋🏻 初次见面,先自我介绍一下:我是 PeterCat,一个开源项目的机器人。你可以通过和我对话配置一个答疑机器人。', shengChengShiBai: '生成失败', shengChengChengGongE: '生成成功', baoCunShiBaiE: '保存失败', diff --git a/client/.kiwi/zh-TW/DeployBotModal.ts b/client/.kiwi/zh-TW/DeployBotModal.ts index 53fba615..08ab0fb5 100644 --- a/client/.kiwi/zh-TW/DeployBotModal.ts +++ b/client/.kiwi/zh-TW/DeployBotModal.ts @@ -13,9 +13,9 @@ export default { shenHeZhong: '審核中...', buShuDaoWoDe: '部署到我的網站', zheJiangTiJiaoYi: - '這將提交一個 issue 到 Peter Cat 倉庫,待我們人工審核通過後即可完成公開。', + '這將提交一個 issue 到 PeterCat 倉庫,待我們人工審核通過後即可完成公開。', ninDeJiQiRen: '您的機器人已經公開到了市場,請前往市場查看。', - gongKaiDaoPE: '公開到 Peter Cat 市場', + gongKaiDaoPE: '公開到 PeterCat 市場', }, DeployItem: { shouQi: '收起', diff --git a/client/.kiwi/zh-TW/app.ts b/client/.kiwi/zh-TW/app.ts index d691c45c..a702fdaf 100644 --- a/client/.kiwi/zh-TW/app.ts +++ b/client/.kiwi/zh-TW/app.ts @@ -5,7 +5,7 @@ export default { xiangMuXiangXiXin: '項目詳細信息請進文檔查閱', chaKanGengDuo: '查看更多', maYiKaiYuan: '螞蟻開源', - pETER: 'Peter Cat 社區', + pETER: 'PeterCat 社區', liaoJieGengDuo: '了解更多', deYiYuQiangDa: '得益於強大的底層能力,您可以將任意感興趣的代碼倉庫轉換為答疑機器人,或體驗社區中其它機器人。它們不僅能推薦優質代碼倉庫,還能協助用戶自動提交\n issue。', @@ -16,7 +16,7 @@ export default { '機器人創建後,所有相關Github 文檔和 issue\n 將自動入庫,作為機器人的知識依據', zhiShiZiDongRu: '知識自動入庫', jinXuYaoGaoZhi: - '僅需要告知你的倉庫地址或名稱,Peter Cat\n 即可自動完成創建機器人的全部流程', + '僅需要告知你的倉庫地址或名稱,PeterCat\n 即可自動完成創建機器人的全部流程', duiHuaJiChuangZao: '對話即創造', woMenTiGongDui: '我們提供對話式答疑 Agent\n 配置系統、自託管部署方案和便捷的一體化應用\n SDK,讓您能夠為自己的 GitHub\n 倉庫一鍵創建智能答疑機器人,並快速集成到各類官網或項目中,\n 為社區提供更高效的技術支持生態。', diff --git a/client/.kiwi/zh-TW/edit.ts b/client/.kiwi/zh-TW/edit.ts index 21c6ee0b..9a76b1eb 100644 --- a/client/.kiwi/zh-TW/edit.ts +++ b/client/.kiwi/zh-TW/edit.ts @@ -14,7 +14,7 @@ export default { gITHU: 'GitHub 項目地址', bangWoPeiZhiYi: '幫我配置一個答疑機器人', chuCiJianMianXian: - '初次見面,先自我介紹一下:我是一個開源項目的機器人。你可以通過和我對話配置一個答疑機器人。', + '👋🏻 初次見面,先自我介紹一下:我是 PeterCat,一個開源項目的機器人。你可以通過和我對話配置一個答疑機器人。', shengChengShiBai: '生成失敗', shengChengChengGongE: '生成成功', baoCunShiBaiE: '保存失敗', diff --git a/client/app/layout.tsx b/client/app/layout.tsx index d05f016f..72221698 100644 --- a/client/app/layout.tsx +++ b/client/app/layout.tsx @@ -22,8 +22,8 @@ export default function RootLayout({ PeterCat - - + + diff --git a/client/app/page.tsx b/client/app/page.tsx index b1897cca..1c9d422f 100644 --- a/client/app/page.tsx +++ b/client/app/page.tsx @@ -380,7 +380,7 @@ export default function Homepage() { width={106} height={20} src="/images/logo-footer.svg" - alt="Peter Cat" + alt="PeterCat" /> {I18N.app.page.shiZhuanWeiSheQu}

@@ -761,7 +761,7 @@ export default function Homepage() { height={20} className="mx-auto lg:mx-0" src="/images/logo-footer.svg" - alt="Peter Cat" + alt="PeterCat" />
From 8c45a3056d4628ea81a09f9685a605032c244071 Mon Sep 17 00:00:00 2001 From: yingying Date: Mon, 18 Nov 2024 16:49:41 +0800 Subject: [PATCH 2/2] chore: change the logo --- assistant/package.json | 4 +- assistant/src/Chat/index.tsx | 116 ++++++++++++++------------ client/package.json | 2 +- client/public/images/logo-footer.svg | 18 ++-- client/public/images/logo-inverse.svg | 26 +++--- client/public/images/logo.svg | 26 +++--- client/yarn.lock | 24 +----- petercat_utils/README.md | 8 +- 8 files changed, 107 insertions(+), 117 deletions(-) diff --git a/assistant/package.json b/assistant/package.json index be59f484..ce09dab2 100644 --- a/assistant/package.json +++ b/assistant/package.json @@ -1,7 +1,7 @@ { "name": "@petercatai/assistant", - "version": "1.0.7", - "description": "Peter Cat Assistant Application", + "version": "1.0.9", + "description": "PeterCat Assistant Application", "module": "dist/esm/index.js", "types": "dist/esm/index.d.ts", "style": "dist/esm/style.css", diff --git a/assistant/src/Chat/index.tsx b/assistant/src/Chat/index.tsx index 2a1026ad..989e6b7f 100644 --- a/assistant/src/Chat/index.tsx +++ b/assistant/src/Chat/index.tsx @@ -10,6 +10,7 @@ import { isEmpty, map } from 'lodash'; import React, { ReactNode, memo, + useCallback, useEffect, useRef, useState, @@ -89,6 +90,65 @@ const Chat: FC = memo( starters: starters, }); + const request = useCallback( + async (messages: any[]) => { + const newMessages = messages + .filter( + (item) => item.role !== Role.tool && item.role !== Role.knowledge, + ) + .map((message) => { + if (message.role === Role.user) { + try { + return { + role: message.role, + // @ts-ignore + content: JSON.parse(message?.content), + }; + } catch (e) { + return message; + } + } else { + const originMessage = convertChunkToJson( + message?.content as string, + ) as any; + const text = + typeof originMessage === 'string' + ? originMessage + : originMessage.message; + return { + role: message.role, + content: [ + { + type: 'text', + text: text, + }, + ], + }; + } + }) as Message[]; + + try { + const response = await streamChat( + newMessages, + apiDomain, + apiUrl, + prompt, + token, + ); + return handleStream(response); + } catch (e: any) { + // 处理请求错误,例如网络错误 + return new Response( + `data: ${JSON.stringify({ + status: 'error', + message: e.message, + })}`, + ); + } + }, + [apiDomain, apiUrl, prompt, token], + ); + useEffect(() => { setBotInfo({ assistantMeta: { @@ -394,61 +454,7 @@ const Chat: FC = memo( } return []; }} - request={async (messages) => { - const newMessages = messages - .filter( - (item) => - item.role !== Role.tool && item.role !== Role.knowledge, - ) - .map((message) => { - if (message.role === Role.user) { - try { - return { - role: message.role, - // @ts-ignore - content: JSON.parse(message?.content), - }; - } catch (e) { - return message; - } - } else { - const originMessage = convertChunkToJson( - message?.content as string, - ) as any; - const text = - typeof originMessage === 'string' - ? originMessage - : originMessage.message; - return { - role: message.role, - content: [ - { - type: 'text', - text: text, - }, - ], - }; - } - }) as Message[]; - try { - const response = await streamChat( - newMessages, - apiDomain, - apiUrl, - prompt, - token, - ); - return handleStream(response); - } catch (e: any) { - // catch query error,such as network error. then return error response for message render - return new Response( - `data: ${JSON.stringify({ - status: 'error', - message: e.message, - })}`, - ); - } - }} + request={request} inputAreaRender={( _: ReactNode, onMessageSend: (message: string) => void | Promise, diff --git a/client/package.json b/client/package.json index f59b66ac..8f513ef6 100644 --- a/client/package.json +++ b/client/package.json @@ -22,7 +22,7 @@ "@fullpage/react-fullpage": "^0.1.42", "@next/bundle-analyzer": "^13.4.19", "@nextui-org/react": "^2.2.9", - "@petercatai/assistant": "^1.0.7", + "@petercatai/assistant": "^1.0.9", "@sentry/nextjs": "^8.28.0", "@supabase/supabase-js": "^2.32.0", "@tanstack/react-query": "^5.17.19", diff --git a/client/public/images/logo-footer.svg b/client/public/images/logo-footer.svg index d0b6639f..a72485e3 100644 --- a/client/public/images/logo-footer.svg +++ b/client/public/images/logo-footer.svg @@ -1,10 +1,10 @@ - - - - - - - - - + + + + + + + + + diff --git a/client/public/images/logo-inverse.svg b/client/public/images/logo-inverse.svg index 89e1d2bc..eb90d7fc 100644 --- a/client/public/images/logo-inverse.svg +++ b/client/public/images/logo-inverse.svg @@ -1,14 +1,14 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/client/public/images/logo.svg b/client/public/images/logo.svg index a63534f5..fa217b67 100644 --- a/client/public/images/logo.svg +++ b/client/public/images/logo.svg @@ -1,14 +1,14 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/client/yarn.lock b/client/yarn.lock index ef379798..ca82a6f6 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -2927,10 +2927,10 @@ resolved "https://registry.npmjs.org/@panva/hkdf/-/hkdf-1.2.1.tgz#cb0d111ef700136f4580349ff0226bf25c853f23" integrity sha512-6oclG6Y3PiDFcoyk8srjLfVKyMfVCKJ27JwNPViuXziFpmdz+MZnZN/aKY0JGXgYuO/VghU0jcOAZgWXZ1Dmrw== -"@petercatai/assistant@^1.0.7": - version "1.0.7" - resolved "https://registry.npmjs.org/@petercatai/assistant/-/assistant-1.0.7.tgz#d3f55048c2dbae901ac7ba0f59f2eb6594a081e6" - integrity sha512-FE/i8ZxakbD9pl2K12KBE1G2PeUhj7HnxB0S8r8GfWwDzq7GZgjwOvnIP6/ooW17e6xhm5J/AWPAldBVjk6RMQ== +"@petercatai/assistant@^1.0.9": + version "1.0.9" + resolved "https://registry.npmjs.org/@petercatai/assistant/-/assistant-1.0.9.tgz#96f2dd4a4d0713627b4a52a5ee61f742e8a2157f" + integrity sha512-mSyF5vwfJ6ucNAVLQvnhsTJd/QuWIRes8GDACrbhlV1iY4mW5RonrPkUL6MtNLb2PSqSxDLEv8beH4UpnJ5Wng== dependencies: "@ant-design/icons" "^5.3.5" "@ant-design/pro-chat" "^1.9.0" @@ -11343,15 +11343,6 @@ string-width@^2.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -11465,13 +11456,6 @@ strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" diff --git a/petercat_utils/README.md b/petercat_utils/README.md index e2018ac4..4f1e21fd 100644 --- a/petercat_utils/README.md +++ b/petercat_utils/README.md @@ -1,6 +1,6 @@ ![banner](https://mdn.alipayobjects.com/huamei_j8gzmo/afts/img/A*m23lS7sVRDgAAAAAAAAAAAAADrPSAQ/original) -

Peter Cat

+

PeterCat

@@ -29,7 +29,7 @@ ### 对话即创造 -仅需要告知你的仓库地址或名称,Peter Cat 即可自动完成创建机器人的全部流程 +仅需要告知你的仓库地址或名称,PeterCat 即可自动完成创建机器人的全部流程 ![对话即创造](https://mdn.alipayobjects.com/huamei_j8gzmo/afts/img/A*aQ9uRoNZGe8AAAAAAAAAAAAADrPSAQ/original) @@ -143,7 +143,7 @@ ## 🤝 参与贡献 -> Peter Cat 使用 yarn 作为包管理器 +> PeterCat 使用 yarn 作为包管理器 ```bash git clone https://github.com/petercat-ai/petercat.git @@ -208,4 +208,4 @@ yarn run publish:pypi ## 📄 License -MIT@[Peter Cat](https://github.com/petercat-ai/petercat/blob/main/LICENSE) +MIT@[PeterCat](https://github.com/petercat-ai/petercat/blob/main/LICENSE)