Skip to content

Commit ddf0f10

Browse files
authored
feat: Open ChatSDK (#820)
1 parent d4c1dfc commit ddf0f10

File tree

276 files changed

+15980
-913
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+15980
-913
lines changed

common/config/subspaces/default/common-versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/common-versions.schema.json",
33
"ensureConsistentVersions": true,
44
"preferredVersions": {
5-
"@coze-arch/coze-design": "0.0.6-alpha.101d0c"
5+
"@coze-arch/coze-design": "0.0.6-alpha.eec92c"
66
},
77
"allowedAlternativeVersions": {
8-
"@coze-arch/coze-design": ["0.0.6-alpha.101d0c"],
8+
"@coze-arch/coze-design": ["0.0.6-alpha.eec92c"],
99
"@rspack/cli": ["0.6.0"],
1010
"@rspack/core": ["0.6.0", ">=0.7"],
1111
"@rspack/plugin-react-refresh": ["0.6.0"],

common/config/subspaces/default/pnpm-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010
},
1111
"globalOverrides": {
12-
"@coze-arch/coze-design": "0.0.6-alpha.101d0c",
12+
"@coze-arch/coze-design": "0.0.6-alpha.eec92c",
1313
"inversify": "6.0.2",
1414
"sass@1.74.1>immutable": "3.8.2",
1515
"web-streams-polyfill": "3.3.2",

common/config/subspaces/default/pnpm-lock.yaml

Lines changed: 788 additions & 450 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
22
{
3-
"preferredVersionsHash": "92954d50ed42b259ae8eb030b1cd5a4aa3b9319e"
3+
"preferredVersionsHash": "683e562f9f3624bdf732fefc244584f915173525"
44
}

frontend/config/rsbuild-config/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import { pluginSass } from '@rsbuild/plugin-sass';
2121
import { pluginReact } from '@rsbuild/plugin-react';
2222
import { pluginLess } from '@rsbuild/plugin-less';
2323
import { type RsbuildConfig, mergeRsbuildConfig } from '@rsbuild/core';
24+
import { SemiRspackPlugin } from '@douyinfe/semi-rspack-plugin';
2425
import { PkgRootWebpackPlugin } from '@coze-arch/pkg-root-webpack-plugin';
2526
import { GLOBAL_ENVS } from '@coze-arch/bot-env';
26-
import { SemiRspackPlugin } from '@douyinfe/semi-rspack-plugin';
2727

2828
const getDefine = () => {
2929
const define = {};
@@ -57,7 +57,7 @@ const generateCdnPrefix = () => {
5757

5858
export const defineConfig = (options: Partial<RsbuildConfig>) => {
5959
const cdnPrefix = generateCdnPrefix();
60-
const port = 8080;
60+
const port = 8081;
6161
const commonAssertsUrl = path.dirname(
6262
require.resolve('@coze-common/assets/package.json'),
6363
);

frontend/config/tailwind-config/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"exports": {
77
".": "./src/index.js",
88
"./coze": "./src/coze.js",
9+
"./util": "./src/util.js",
910
"./design-token": "./src/design-token.ts"
1011
},
1112
"main": "src/index.js",
Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
/*
2+
* Copyright 2025 coze-dev Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
const plugin = require('tailwindcss/plugin');
18+
19+
const lightModeVariables = require('./light');
20+
const darkModeVariables = require('./dark');
21+
22+
// 用于生成 CSS 变量的帮助函数
23+
function generateCssVariables(variables, theme) {
24+
return Object.entries(variables).reduce((acc, [key, value]) => {
25+
acc[`--${key}`] = theme ? theme(value) : value;
26+
return acc;
27+
}, {});
28+
}
29+
30+
// 样式语义化
31+
function generateSemanticVariables(semantics, theme, property) {
32+
return Object.entries(semantics).map(([key, value]) => ({
33+
[`.${key}`]: {
34+
[property]: theme(value),
35+
},
36+
}));
37+
}
38+
39+
const semanticForeground = {
40+
/* Theme */
41+
'coz-fg-hglt-plus': 'colors.foreground.5',
42+
'coz-fg-hglt-plus-dim': 'colors.foreground.5',
43+
'coz-fg-hglt': 'colors.brand.5',
44+
'coz-fg-hglt-dim': 'colors.brand.3',
45+
'coz-fg-plus': 'colors.foreground.4',
46+
'coz-fg': 'colors.foreground.3',
47+
'coz-fg-primary': 'colors.foreground.3',
48+
'coz-fg-secondary': 'colors.foreground.2',
49+
'coz-fg-dim': 'colors.foreground.1',
50+
'coz-fg-white': 'colors.foreground.7',
51+
'coz-fg-white-dim': 'colors.foreground.white',
52+
'coz-fg-hglt-ai': 'colors.purple.5',
53+
'coz-fg-hglt-ai-dim': 'colors.purple.3',
54+
/* Functional Color */
55+
'coz-fg-hglt-red': 'colors.red.5',
56+
'coz-fg-hglt-red-dim': 'colors.red.3',
57+
'coz-fg-hglt-yellow': 'colors.yellow.5',
58+
'coz-fg-hglt-yellow-dim': 'colors.yellow.3',
59+
'coz-fg-hglt-green': 'colors.green.5',
60+
'coz-fg-hglt-green-dim': 'colors.green.3',
61+
/* Chart, Tag Only */
62+
'coz-fg-color-orange': 'colors.yellow.5',
63+
'coz-fg-color-orange-dim': 'colors.yellow.3',
64+
'coz-fg-color-emerald': 'colors.green.5',
65+
'coz-fg-color-emerald-dim': 'colors.green.3',
66+
'coz-fg-color-cyan': 'colors.cyan.50',
67+
'coz-fg-color-cyan-dim': 'colors.cyan.30',
68+
'coz-fg-color-blue': 'colors.blue.50',
69+
'coz-fg-color-blue-dim': 'colors.blue.30',
70+
'coz-fg-color-purple': 'colors.purple.50',
71+
'coz-fg-color-purple-dim': 'colors.purple.30',
72+
'coz-fg-color-magenta': 'colors.magenta.50',
73+
'coz-fg-color-magenta-dim': 'colors.magenta.3',
74+
'coz-fg-color-yellow': 'colors.yellow.50',
75+
'coz-fg-color-yellow-dim': 'colors.yellow.30',
76+
/* Code Only */
77+
'coz-fg-hglt-orange': 'colors.orange.5',
78+
'coz-fg-hglt-orange-dim': 'colors.orange.3',
79+
'coz-fg-hglt-emerald': 'colors.emerald.5',
80+
'coz-fg-hglt-emerald-dim': 'colors.emerald.3',
81+
'coz-fg-hglt-cyan': 'colors.cyan.5',
82+
'coz-fg-hglt-cyan-dim': 'colors.cyan.3',
83+
'coz-fg-hglt-blue': 'colors.blue.5',
84+
'coz-fg-hglt-blue-dim': 'colors.blue.3',
85+
'coz-fg-hglt-purple': 'colors.purple.5',
86+
'coz-fg-hglt-purple-dim': 'colors.purple.3',
87+
'coz-fg-hglt-magenta': 'colors.magenta.5',
88+
'coz-fg-hglt-magenta-dim': 'colors.magenta.3',
89+
/* branding Only */
90+
'coz-fg-color-brand': 'colors.brand.50',
91+
'coz-fg-color-brand-dim': 'colors.brand.30',
92+
'coz-fg-color-alternative': 'colors.alternative.50',
93+
'coz-fg-color-alternative-dim': 'colors.alternative.30',
94+
};
95+
96+
const semanticMiddleground = {
97+
/* Theme */
98+
'coz-mg-hglt-plus-pressed': 'colors.brand.7',
99+
'coz-mg-hglt-plus-hovered': 'colors.brand.6',
100+
'coz-mg-hglt-plus': 'colors.brand.5',
101+
'coz-mg-hglt-plus-dim': 'colors.brand.3',
102+
'coz-mg-hglt-secondary-pressed': 'colors.brand.2',
103+
'coz-mg-hglt-secondary-hovered': 'colors.brand.1',
104+
'coz-mg-hglt-secondary': 'colors.brand.0',
105+
'coz-mg-hglt-secondary-red': 'colors.red.0',
106+
'coz-mg-hglt-secondary-yellow': 'colors.yellow.0',
107+
'coz-mg-hglt-secondary-green': 'colors.green.0',
108+
'coz-mg-plus-pressed': 'colors.background.8',
109+
'coz-mg-plus-hovered': 'colors.background.7',
110+
'coz-mg-plus': 'colors.background.6',
111+
'coz-mg-hglt-pressed': 'colors.brand.3',
112+
'coz-mg-hglt-hovered': 'colors.brand.2',
113+
'coz-mg-hglt-plus-ai-pressed': 'colors.purple.7',
114+
'coz-mg-hglt-plus-ai-hovered': 'colors.purple.6',
115+
'coz-mg-hglt-plus-ai': 'colors.purple.5',
116+
'coz-mg-hglt-plus-ai-dim': 'colors.purple.3',
117+
'coz-mg-hglt': 'colors.brand.1',
118+
'coz-mg-hglt-ai-pressed': 'colors.purple.3',
119+
'coz-mg-hglt-ai-hovered': 'colors.purple.2',
120+
'coz-mg-hglt-ai': 'colors.purple.1',
121+
/* Functional Color */
122+
'coz-mg-hglt-plus-red-pressed': 'colors.red.7',
123+
'coz-mg-hglt-plus-red-hovered': 'colors.red.6',
124+
'coz-mg-hglt-plus-red': 'colors.red.5',
125+
'coz-mg-hglt-plus-red-dim': 'colors.red.3',
126+
'coz-mg-hglt-plus-yellow-pressed': 'colors.yellow.7',
127+
'coz-mg-hglt-plus-yellow-hovered': 'colors.yellow.6',
128+
'coz-mg-hglt-plus-yellow': 'colors.yellow.5',
129+
'coz-mg-hglt-plus-yellow-dim': 'colors.yellow.3',
130+
'coz-mg-hglt-plus-green-pressed': 'colors.green.7',
131+
'coz-mg-hglt-plus-green-hovered': 'colors.green.6',
132+
'coz-mg-hglt-plus-green': 'colors.green.5',
133+
'coz-mg-hglt-plus-green-dim': 'colors.green.3',
134+
'coz-mg-hglt-red-pressed': 'colors.red.3',
135+
'coz-mg-hglt-red-hovered': 'colors.red.2',
136+
'coz-mg-hglt-red': 'colors.red.1',
137+
'coz-mg-hglt-yellow-pressed': 'colors.yellow.3',
138+
'coz-mg-hglt-yellow-hovered': 'colors.yellow.2',
139+
'coz-mg-hglt-yellow': 'colors.yellow.1',
140+
'coz-mg-hglt-green-pressed': 'colors.green.3',
141+
'coz-mg-hglt-green-hovered': 'colors.green.2',
142+
'coz-mg-hglt-green': 'colors.green.1',
143+
/* Card, Tag, Avatar Only */
144+
'coz-mg-color-plus-orange': 'colors.yellow.5',
145+
'coz-mg-color-plus-emerald': 'colors.green.5',
146+
'coz-mg-color-plus-cyan': 'colors.cyan.50',
147+
'coz-mg-color-plus-blue': 'colors.blue.50',
148+
'coz-mg-color-plus-purple': 'colors.purple.50',
149+
'coz-mg-color-plus-magenta': 'colors.magenta.50',
150+
'coz-mg-color-plus-yellow': 'colors.yellow.50',
151+
'coz-mg-color-orange-pressed': 'colors.yellow.3',
152+
'coz-mg-color-orange-hovered': 'colors.yellow.2',
153+
'coz-mg-color-orange': 'colors.yellow.1',
154+
'coz-mg-color-emerald-pressed': 'colors.green.3',
155+
'coz-mg-color-emerald-hovered': 'colors.green.2',
156+
'coz-mg-color-emerald': 'colors.green.1',
157+
'coz-mg-color-cyan-pressed': 'colors.cyan.30',
158+
'coz-mg-color-cyan-hovered': 'colors.cyan.20',
159+
'coz-mg-color-cyan': 'colors.cyan.10',
160+
'coz-mg-color-blue-pressed': 'colors.blue.30',
161+
'coz-mg-color-blue-hovered': 'colors.blue.20',
162+
'coz-mg-color-blue': 'colors.blue.10',
163+
'coz-mg-color-purple-pressed': 'colors.purple.30',
164+
'coz-mg-color-purple-hovered': 'colors.purple.20',
165+
'coz-mg-color-purple': 'colors.purple.10',
166+
'coz-mg-color-magenta-pressed': 'colors.magenta.30',
167+
'coz-mg-color-magenta-hovered': 'colors.magenta.20',
168+
'coz-mg-color-magenta': 'colors.magenta.10',
169+
'coz-mg-primary-pressed': 'colors.background.7',
170+
'coz-mg-primary-hovered': 'colors.background.6',
171+
'coz-mg-primary': 'colors.background.5',
172+
'coz-mg-secondary-pressed': 'colors.background.6',
173+
'coz-mg-secondary-hovered': 'colors.background.5',
174+
'coz-mg-secondary': 'colors.background.4',
175+
'coz-mg': 'colors.background.4',
176+
'coz-mg-mask': 'colors.mask.5',
177+
'coz-mg-table-fixed-hovered': 'colors.background.0',
178+
'coz-mg-card-pressed': 'colors.background.3',
179+
'coz-mg-card-hovered': 'colors.background.3',
180+
'coz-mg-card': 'colors.background.3',
181+
/** brand */
182+
'coz-mg-color-plus-brand': 'colors.brand.50',
183+
};
184+
185+
const semanticBackground = {
186+
'coz-bg-max': 'colors.background.3',
187+
'coz-bg-plus': 'colors.background.2',
188+
'coz-bg-primary': 'colors.background.1',
189+
'coz-bg': 'colors.background.1',
190+
'coz-bg-secondary': 'colors.background.0',
191+
};
192+
193+
const semanticShadow = {
194+
'coz-shadow': 'boxShadow.normal',
195+
'coz-shadow-large': 'boxShadow.large',
196+
'coz-shadow-default': 'boxShadow.normal',
197+
'coz-shadow-small': 'boxShadow.small',
198+
};
199+
200+
// Add button rounded definitions
201+
const buttonRounded = {
202+
'coz-btn-rounded-large': 'btnBorderRadius.large',
203+
'coz-btn-rounded-normal': 'btnBorderRadius.normal',
204+
'coz-btn-rounded-small': 'btnBorderRadius.small',
205+
'coz-btn-rounded-mini': 'btnBorderRadius.mini',
206+
};
207+
208+
const inputRounded = {
209+
'coz-input-rounded-large': 'inputBorderRadius.large',
210+
'coz-input-rounded-normal': 'inputBorderRadius.normal',
211+
'coz-input-rounded-small': 'inputBorderRadius.small',
212+
};
213+
214+
const inputHeight = {
215+
'coz-input-height-large': 'inputHeight.large',
216+
'coz-input-height-normal': 'inputHeight.normal',
217+
'coz-input-height-small': 'inputHeight.small',
218+
};
219+
220+
const semanticStroke = {
221+
'coz-stroke-hglt': 'colors.brand.5',
222+
'coz-stroke-plus': 'colors.stroke.6',
223+
'coz-stroke-primary': 'colors.stroke.5',
224+
'coz-stroke-hglt-red': 'colors.red.5',
225+
'coz-stroke-hglt-yellow': 'colors.yellow.5',
226+
'coz-stroke-hglt-green': 'colors.green.5',
227+
'coz-stroke-color-orange': 'colors.yellow.5',
228+
'coz-stroke-color-emerald': 'colors.green.5',
229+
'coz-stroke-color-cyan': 'colors.cyan.50',
230+
'coz-stroke-color-blue': 'colors.blue.50',
231+
'coz-stroke-color-purple': 'colors.purple.50',
232+
'coz-stroke-color-magenta': 'colors.magenta.50',
233+
'coz-stroke-color-yellow': 'colors.yellow.50',
234+
'coz-stroke-color-brand': 'colors.brand.50',
235+
'coz-stroke-opaque': 'colors.stroke.opaque',
236+
'coz-stroke-max': 'colors.stroke.max',
237+
};
238+
239+
function genTailwindPlugin(defaultCls, darkCls) {
240+
return plugin(function ({ addBase, addUtilities, theme }) {
241+
addBase({
242+
[defaultCls]: generateCssVariables(lightModeVariables),
243+
[darkCls]: generateCssVariables(darkModeVariables),
244+
});
245+
246+
addBase({
247+
[defaultCls]: {
248+
...generateCssVariables(semanticForeground, theme),
249+
...generateCssVariables(semanticMiddleground, theme),
250+
...generateCssVariables(semanticBackground, theme),
251+
...generateCssVariables(semanticStroke, theme),
252+
...generateCssVariables(semanticShadow, theme),
253+
...generateCssVariables(buttonRounded, theme),
254+
...generateCssVariables(inputRounded, theme),
255+
...generateCssVariables(inputHeight, theme),
256+
},
257+
});
258+
259+
addUtilities([
260+
...generateSemanticVariables(semanticForeground, theme, 'color'),
261+
...generateSemanticVariables(
262+
semanticMiddleground,
263+
theme,
264+
'background-color',
265+
),
266+
...generateSemanticVariables(
267+
semanticBackground,
268+
theme,
269+
'background-color',
270+
),
271+
...generateSemanticVariables(semanticStroke, theme, 'border-color'),
272+
...generateSemanticVariables(semanticShadow, theme, 'box-shadow'),
273+
...generateSemanticVariables(buttonRounded, theme, 'border-radius'),
274+
...generateSemanticVariables(inputRounded, theme, 'border-radius'),
275+
...generateSemanticVariables(inputHeight, theme, 'height'),
276+
]);
277+
});
278+
}
279+
280+
module.exports = {
281+
genTailwindPlugin,
282+
};

frontend/packages/agent-ide/space-bot/src/hook/use-create-bot/form-switch/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ function SwitchWithDesc({
4545
);
4646
}
4747

48-
export const FormSwitch = withField(SwitchWithDesc);
48+
export const FormSwitch = withField(SwitchWithDesc) as ReturnType<
49+
typeof withField
50+
>;

frontend/packages/arch/bot-env-adapter/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
"maintainers": [],
88
"exports": {
99
".": "./src/index.ts",
10+
"./configs": "./src/configs.ts",
1011
"./build": "./scripts/build.ts",
1112
"./typings": "./src/typings.d.ts",
1213
"./runtime": "./src/runtime/index.ts"
1314
},
1415
"main": "src/index.ts",
1516
"typesVersions": {
1617
"*": {
18+
"configs": [
19+
"./src/configs.ts"
20+
],
1721
"build": [
1822
"./scripts/build.ts"
1923
],

frontend/packages/common/chat-area/chat-answer-action/src/components/action-bar-hover-container/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { type PropsWithChildren } from 'react';
17+
import { forwardRef, type PropsWithChildren } from 'react';
1818

1919
import classNames from 'classnames';
2020

@@ -25,14 +25,16 @@ interface ActionBarHoverContainerProps {
2525
style?: React.CSSProperties;
2626
}
2727

28-
export const ActionBarHoverContainer: React.FC<
28+
export const ActionBarHoverContainer = forwardRef<
29+
HTMLDivElement,
2930
PropsWithChildren<ActionBarHoverContainerProps>
30-
> = ({ children, style }) => (
31+
>(({ children, style }, ref) => (
3132
<div
3233
data-testid="chat-area.answer-action.hover-action-bar"
3334
className={classNames(s.container, ['coz-stroke-primary', 'coz-bg-max'])}
3435
style={style}
36+
ref={ref}
3537
>
3638
{children}
3739
</div>
38-
);
40+
));

0 commit comments

Comments
 (0)