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

chore: change the logo and release @petercatai/assistant #484

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions README.en-US.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img width="1785" alt="image" src="https://github.com/user-attachments/assets/50ae3bb2-e4da-4537-8df0-89a1ce23e800">


# Peter Cat
# PeterCat

<div align="center">

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
4 changes: 2 additions & 2 deletions README.ja-JP.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img width="1785" alt="image" src="https://github.com/user-attachments/assets/50ae3bb2-e4da-4537-8df0-89a1ce23e800">


# Peter Cat
# PeterCat

<div align="center">

Expand Down Expand Up @@ -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)
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![banner](https://mdn.alipayobjects.com/huamei_j8gzmo/afts/img/A*m23lS7sVRDgAAAAAAAAAAAAADrPSAQ/original)

<h1 align="center"> Peter Cat</h1>
<h1 align="center"> PeterCat</h1>

<div align="center">

Expand Down Expand Up @@ -29,7 +29,7 @@

### 对话即创造

仅需要告知你的仓库地址或名称,Peter Cat 即可自动完成创建机器人的全部流程
仅需要告知你的仓库地址或名称,PeterCat 即可自动完成创建机器人的全部流程

![对话即创造](https://mdn.alipayobjects.com/huamei_j8gzmo/afts/img/A*aQ9uRoNZGe8AAAAAAAAAAAAADrPSAQ/original)

Expand Down Expand Up @@ -143,7 +143,7 @@

## 🤝 参与贡献

> Peter Cat 使用 yarn 作为包管理器
> PeterCat 使用 yarn 作为包管理器

```bash
git clone https://github.com/petercat-ai/petercat.git
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion assistant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions assistant/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
116 changes: 61 additions & 55 deletions assistant/src/Chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { isEmpty, map } from 'lodash';
import React, {
ReactNode,
memo,
useCallback,
useEffect,
useRef,
useState,
Expand Down Expand Up @@ -89,6 +90,65 @@ const Chat: FC<ChatProps> = 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),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the content being parsed with JSON.parse is always a valid JSON string to prevent runtime errors. Consider adding validation or try-catch logic to handle potential parsing errors gracefully.

};
} 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: {
Expand Down Expand Up @@ -394,61 +454,7 @@ const Chat: FC<ChatProps> = 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<any>,
Expand Down
2 changes: 1 addition & 1 deletion assistant/src/mock/bot.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 答疑机器人',
Expand Down
4 changes: 2 additions & 2 deletions client/.kiwi/en/DeployBotModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
7 changes: 3 additions & 4 deletions client/.kiwi/en/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand All @@ -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.',
Expand Down
2 changes: 1 addition & 1 deletion client/.kiwi/en/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion client/.kiwi/ja/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
xiangMuXiangXiXin: 'プロジェクトの詳細情報はドキュメントでご確認ください',
chaKanGengDuo: 'もっと見る',
maYiKaiYuan: 'アントオープンソース',
pETER: 'Peter Cat コミュニティ',
pETER: 'PeterCat コミュニティ',
liaoJieGengDuo: '詳細を知る',
deYiYuQiangDa:
'強力な基盤により、気になるコードリポジトリをQ&Aボットに変換したり、他のコミュニティボットを体験できます。これらは優れたコードリポジトリを推薦するだけでなく、ユーザーが自動的にissueを提出するのも支援します。',
Expand Down
2 changes: 1 addition & 1 deletion client/.kiwi/ja/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
gITHU: 'GitHubプロジェクトのアドレス',
bangWoPeiZhiYi: 'Q&Aボットの設定を手伝ってください',
chuCiJianMianXian:
'はじめまして、私はオープンソースプロジェクトのボットです。私との対話を通じてQ&Aボットを設定できます。',
'👋🏻 こんにちは!初めまして、自己紹介させていただきます。私はPeterCatと申します。オープンソースプロジェクトのロボットです。私と対話することで、Q&Aロボットを設定できます。',
shengChengShiBai: '生成に失敗しました',
shengChengChengGongE: '生成に成功しました',
baoCunShiBaiE: '保存に失敗しました',
Expand Down
4 changes: 2 additions & 2 deletions client/.kiwi/ko/DeployBotModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export default {
shenHeZhong: '검토 중...',
buShuDaoWoDe: '내 웹사이트에 배포',
zheJiangTiJiaoYi:
'이것은 Peter Cat 저장소에 issue를 제출하게 되며, 우리 인공 검토를 통과하면 공개될 수 있습니다.',
'이것은 PeterCat 저장소에 issue를 제출하게 되며, 우리 인공 검토를 통과하면 공개될 수 있습니다.',
ninDeJiQiRen: '당신의 봇이 시장에 공개되었습니다. 시장을 확인해 보세요.',
gongKaiDaoPE: 'Peter Cat 시장에 공개',
gongKaiDaoPE: 'PeterCat 시장에 공개',
},
DeployItem: {
shouQi: '접기',
Expand Down
2 changes: 1 addition & 1 deletion client/.kiwi/ko/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
xiangMuXiangXiXin: '프로젝트의 자세한 정보는 문서를 참조하십시오.',
chaKanGengDuo: '더 보기',
maYiKaiYuan: '앤트 오픈소스',
pETER: 'Peter Cat 커뮤니티',
pETER: 'PeterCat 커뮤니티',
liaoJieGengDuo: '더 알아보기',
deYiYuQiangDa:
'강력한 기본 능력 덕분에 관심 있는 코드 저장소를 Q&A 봇으로 전환하거나 커뮤니티의 다른 봇을 체험할 수 있습니다. 이들은 우수한 코드 저장소를 추천할 뿐만 아니라 사용자가 issue를 자동으로 제출할 수 있도록 도와줍니다.',
Expand Down
2 changes: 1 addition & 1 deletion client/.kiwi/ko/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
gITHU: 'GitHub 프로젝트 주소',
bangWoPeiZhiYi: 'Q&A 봇 설정을 도와주세요.',
chuCiJianMianXian:
'처음 뵙겠습니다, 저는 오픈 소스 프로젝트 봇입니다. 저와 대화를 통해 Q&A 봇을 설정할 수 있습니다.',
'👋🏻 안녕하세요! 처음 뵙겠습니다. 제 소개를 하겠습니다: 저는 PeterCat입니다, 오픈소스 프로젝트의 로봇입니다. 저와 대화를 통해 질의응답 로봇을 구성할 수 있습니다.',
shengChengShiBai: '생성 실패',
shengChengChengGongE: '생성 성공',
baoCunShiBaiE: '저장 실패',
Expand Down
4 changes: 2 additions & 2 deletions client/.kiwi/zh-CN/DeployBotModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export default {
shenHeZhong: '审核中...',
buShuDaoWoDe: '部署到我的网站',
zheJiangTiJiaoYi:
'这将提交一个 issue 到 Peter Cat\n 仓库,待我们人工审核通过后即可完成公开。',
'这将提交一个 issue 到 PeterCat\n 仓库,待我们人工审核通过后即可完成公开。',
ninDeJiQiRen: '您的机器人已经公开到了市场,请前往市场查看。',
gongKaiDaoPE: '公开到 Peter Cat 市场',
gongKaiDaoPE: '公开到 PeterCat 市场',
},
DeployItem: {
shouQi: '收起',
Expand Down
4 changes: 2 additions & 2 deletions client/.kiwi/zh-CN/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
xiangMuXiangXiXin: '项目详细信息请进文档查阅',
chaKanGengDuo: '查看更多',
maYiKaiYuan: '蚂蚁开源',
pETER: 'Peter Cat 社区',
pETER: 'PeterCat 社区',
liaoJieGengDuo: '了解更多',
deYiYuQiangDa:
'得益于强大的底层能力,您可以将任意感兴趣的代码仓库转换为答疑机器人,或体验社区中其它机器人。它们不仅能推荐优质代码仓库,还能协助用户自动提交\n issue。',
Expand All @@ -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 为社区提供更高效的技术支持生态。',
Expand Down
2 changes: 1 addition & 1 deletion client/.kiwi/zh-CN/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
gITHU: 'Github 项目地址',
bangWoPeiZhiYi: '帮我配置一个答疑机器人',
chuCiJianMianXian:
'初次见面,先自我介绍一下:我是一个开源项目的机器人。你可以通过和我对话配置一个答疑机器人。',
'👋🏻 初次见面,先自我介绍一下:我是 PeterCat,一个开源项目的机器人。你可以通过和我对话配置一个答疑机器人。',
shengChengShiBai: '生成失败',
shengChengChengGongE: '生成成功',
baoCunShiBaiE: '保存失败',
Expand Down
Loading