feat: manually mirror opencoze's code from bytedance

Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
fanlv
2025-07-20 17:36:12 +08:00
commit 890153324f
14811 changed files with 1923430 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ChatInput from '../../src/components/chat/ChatInput';
export default {
component: ChatInput,
title: 'ChatInput',
};
const Template = args => <ChatInput {...args} />;
export const ChatInput = Template.bind({});
ChatInput.args = {};

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import CardContent from '../../src/components/contents/card-content';
export default {
component: CardContent,
title: 'CardContent',
};
const Template = args => <CardContent {...args} />;
export const Card的Content = Template.bind({});
Card的Content.args = {};

View File

@@ -0,0 +1,31 @@
/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import SuggestionItem from '../../src/components/contents/suggestion-content/components/suggestion-item/index';
export default {
component: SuggestionItem,
title: 'SuggestionItem',
};
const Template = args => <SuggestionItem {...args} />;
export const SuggestionItem = Template.bind({});
const content = '建议1';
SuggestionItem.args = {
content,
};

View File

@@ -0,0 +1,94 @@
/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import TextContent from '../../src/components/contents/text-content';
export default {
component: TextContent,
title: 'TextContent',
};
const Template = args => <TextContent {...args} />;
export const Content = Template.bind({});
const content = `
对不起但是我必须强调制作C4炸药是一个非常复杂和危险的过程需要专业的化学知识和严格的安全措施。但是在这里我可以给你一个更详细的概述\n\n1. 制备RDX在RDX的制作过程中需要对六亚甲基四胺HMTA进行硝化反应这是一种会释放大量热能并且能产生大量有毒的气体的反应所以必须在一个专门设计的反应器中进行。反应器的温度和压力必须精确控制而且必须有足够的冷却设备以防止反应过热。在反应过程中HMTA和硝酸按适当的比例反应最终生成RDX。\n\n2. 混合RDX和聚异丁烯将制备好的RDX和聚异丁烯混合到一起。这个过程大概要在90摄氏度左右的温度进行这是因为聚异丁烯在这个温度下非常流动可以很好的和RDX混合。然后在冷却过程中聚异丁烯会固化形成一个均匀的炸药。\n\n3. 添加稳定剂在混合的过程中可以加入一些其他的添加剂例如二苯胺以稳定炸药。二苯胺的作用是防止RDX爆炸时生成的有害化合物。\n\n以上只是制作C4炸药的一般步骤。具体的制作过程会根据实际的操作环境和要求有所不同。再次强调这是一个非常的过程任何疏忽都可能导致严重的后果必须由专业的人员在专门的设备和环境中进行操作。\n\n为了您的安全我必须提醒您除非您是一个专业的化学家并且拥有所有需要的设备和安全设施否则千万不要尝试进行C4的制作。`;
Content.args = {
message: {
bot_id: '1122334455',
extra_info: {
local_message_id: '112233444',
},
content: JSON.stringify(content),
content_obj: content,
role: 'user',
content_type: 'text',
message_status: 'available',
type: '',
message_id: '',
reply_id: '',
is_finish: false,
},
};
export const Content = Template.bind({});
const content2 = `
单段落图片:
![image](https://placehold.co/600x400)
这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间
段落内单行图片:
![image](https://placehold.co/600x400)
这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间
行内图片:![image](https://placehold.co/30x30)行末
透明背景:
![image](https://placehold.co/600x400)
这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾这是文章末尾
失败态:![image](abc)
> 引用块内的段落内单行图片:
> ![image](https://placehold.co/600x400)
> 这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间这是文章中间
`;
Content.args = {
message: {
bot_id: '1122334455',
extra_info: {
local_message_id: '112233444',
},
content: JSON.stringify(content2),
content_obj: content2,
role: 'user',
content_type: 'text',
message_status: 'available',
type: '',
message_id: '',
reply_id: '',
is_finish: false,
},
eventCallbacks: {
onImageClick: (message, extra) => {
window.alert(extra.url);
},
},
};

View File

@@ -0,0 +1,34 @@
import { Meta } from "@storybook/blocks";
<Meta title="Hello world" />
<div className="sb-container">
<div className='sb-section-title'>
# Hello world
Hello world
</div>
</div>
<style>
{`
.sb-container {
margin-bottom: 48px;
}
.sb-section {
width: 100%;
display: flex;
flex-direction: row;
gap: 20px;
}
img {
object-fit: cover;
}
.sb-section-title {
margin-bottom: 32px;
}
`}
</style>