chore: setup increment ci env (#109)
This commit is contained in:
parent
4a44c0ddbd
commit
9dcdb70508
|
|
@ -0,0 +1,294 @@
|
|||
name: CI
|
||||
on:
|
||||
pull_request:
|
||||
branches: ['main']
|
||||
paths:
|
||||
- 'github/**'
|
||||
- 'idl/**'
|
||||
- 'frontend/**'
|
||||
- 'common/**'
|
||||
- 'rush.json'
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- NodeVersion: 22.16.0
|
||||
NodeVersionDisplayName: 22
|
||||
OS: ubuntu-latest
|
||||
name: Setup and Install Dependencies
|
||||
runs-on: ${{ matrix.OS }}
|
||||
outputs:
|
||||
cache_file: ${{ steps.process-files.outputs.cache_file }}
|
||||
matrix_node_version: ${{ matrix.NodeVersion }}
|
||||
matrix_os: ${{ matrix.OS }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v45
|
||||
|
||||
- name: Process changed files
|
||||
id: process-files
|
||||
run: |
|
||||
# 获取所有变更文件
|
||||
all_files="${{ steps.changed-files.outputs.all_changed_files }}"
|
||||
|
||||
# 过滤掉 common/changes 目录下的文件
|
||||
filtered_files=""
|
||||
for file in $all_files; do
|
||||
if [[ ! "$file" =~ ^common/changes/.* ]]; then
|
||||
if [ -z "$filtered_files" ]; then
|
||||
filtered_files="$file"
|
||||
else
|
||||
filtered_files="$filtered_files $file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# 创建 JSON 格式的缓存文件
|
||||
echo "[$( echo "$filtered_files" | sed 's/ /", "/g' | sed 's/^/"/' | sed 's/$/"/' )]" > changed-files-cache.json
|
||||
|
||||
# 输出缓存文件路径供后续步骤使用
|
||||
echo "cache_file=changed-files-cache.json" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "过滤前文件数量: $(echo $all_files | wc -w)"
|
||||
echo "过滤后文件数量: $(echo $filtered_files | wc -w)"
|
||||
echo "已生成缓存文件: changed-files-cache.json"
|
||||
|
||||
- name: Config Git User
|
||||
# should be turn to ci user
|
||||
run: |
|
||||
git config --local user.name "flow_bot"
|
||||
git config --local user.email "flow_bot@bytedance.com"
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.NodeVersion }}
|
||||
|
||||
- name: Upload changed files cache
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
path: changed-files-cache.json
|
||||
retention-days: 1
|
||||
|
||||
build:
|
||||
needs: setup
|
||||
runs-on: ${{ needs.setup.outputs.matrix_os }}
|
||||
name: Increment Build
|
||||
env:
|
||||
BUILD_BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ needs.setup.outputs.matrix_node_version }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/subspaces/**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Download changed files cache
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install --to tag:core
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name plugins
|
||||
node common/scripts/install-run-rush.js increment --action install -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
- name: Increment Build
|
||||
run: node common/scripts/install-run-rush.js increment --action build -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
test:
|
||||
needs: setup
|
||||
runs-on: ${{ needs.setup.outputs.matrix_os }}
|
||||
name: Increment Test Coverage
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ needs.setup.outputs.matrix_node_version }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/subspaces/**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Download changed files cache
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install --to tag:core
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name plugins
|
||||
node common/scripts/install-run-rush.js increment --action install -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
- name: Increment Test:cov
|
||||
run: node common/scripts/install-run-rush.js increment --action test:cov -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
- name: Upload coverage reports
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
||||
|
||||
lint:
|
||||
needs: setup
|
||||
runs-on: ${{ needs.setup.outputs.matrix_os }}
|
||||
name: Increment Lint
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ needs.setup.outputs.matrix_node_version }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/subspaces/**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Download changed files cache
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install --to tag:core
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name plugins
|
||||
node common/scripts/install-run-rush.js increment --action install -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
- name: Increment Lint
|
||||
run: node common/scripts/install-run-rush.js increment --action lint -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
ts-check:
|
||||
needs: setup
|
||||
runs-on: ${{ needs.setup.outputs.matrix_os }}
|
||||
name: Increment TS Check
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ needs.setup.outputs.matrix_node_version }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/subspaces/**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Download changed files cache
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install --to tag:core
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name plugins
|
||||
node common/scripts/install-run-rush.js increment --action install -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
- name: Increment TS Check
|
||||
run: node common/scripts/install-run-rush.js increment --action ts-check -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
package-audit:
|
||||
needs: setup
|
||||
runs-on: ${{ needs.setup.outputs.matrix_os }}
|
||||
name: Increment Package Audit
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ needs.setup.outputs.matrix_node_version }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/subspaces/**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Download changed files cache
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changed-files-cache
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install --to tag:core
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name plugins
|
||||
node common/scripts/install-run-rush.js increment --action install -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
||||
- name: Increment Package Audit
|
||||
run: node common/scripts/install-run-rush.js increment --action package-audit -p "${{ needs.setup.outputs.cache_file }}"
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
# should be optimize as increment build & test
|
||||
name: CI@main
|
||||
on:
|
||||
push:
|
||||
# test only
|
||||
branches: ['main',"chore/setup-ci"]
|
||||
paths:
|
||||
- 'github/**'
|
||||
- 'idl/**'
|
||||
- 'frontend/**'
|
||||
- 'common/**'
|
||||
- 'rush.json'
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- NodeVersion: 22.16.0
|
||||
NodeVersionDisplayName: 22
|
||||
OS: ubuntu-latest
|
||||
name: Node.js v${{ matrix.NodeVersionDisplayName }} (${{ matrix.OS }})
|
||||
runs-on: ${{ matrix.OS }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Config Git User
|
||||
# should be turn to ci user
|
||||
run: |
|
||||
git config --local user.name "flow_bot"
|
||||
git config --local user.email "flow_bot@bytedance.com"
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.NodeVersion }}
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
common/temp/pnpm-local
|
||||
common/temp/pnpm-store
|
||||
common/temp/install-run
|
||||
key: ${{ runner.os }}-rush-store-main
|
||||
restore-keys: |
|
||||
${{ runner.os }}-rush-store-main
|
||||
${{ runner.os }}-rush-store
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libasound2-dev
|
||||
node common/scripts/install-run-rush.js install
|
||||
|
||||
- name: Build all
|
||||
run: node common/scripts/install-run-rush.js build --verbose
|
||||
|
||||
- name: Test:cov all
|
||||
run: node common/scripts/install-run-rush.js test:cov --verbose
|
||||
|
||||
- name: Upload coverage reports
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
||||
|
||||
- name: Lint all
|
||||
run: node common/scripts/install-run-rush.js lint --verbose
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
name: PR Common Checks
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'github/**'
|
||||
- 'idl/**'
|
||||
- 'frontend/**'
|
||||
- 'common/**'
|
||||
- 'rush.json'
|
||||
types: [opened, edited, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
common-checks:
|
||||
name: PR Common Checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Config Git User
|
||||
run: |
|
||||
git config --local user.name "flow_bot"
|
||||
git config --local user.email "flow_bot@bytedance.com"
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 22.16.0
|
||||
|
||||
- name: Install Dependencies
|
||||
run: node common/scripts/install-run-rush.js install
|
||||
|
||||
# PR Title Format Check
|
||||
- name: Check PR Title Format
|
||||
if: ${{ !contains(github.event.pull_request.title, 'WIP') && !contains(github.event.pull_request.title, 'wip') }}
|
||||
env:
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
run: |
|
||||
node common/scripts/install-run-rush.js update-autoinstaller --name rush-commitlint && \
|
||||
pushd common/autoinstallers/rush-commitlint && \
|
||||
echo "$PR_TITLE" | npx commitlint --config commitlint.config.js && \
|
||||
popd
|
||||
|
||||
# Add more common checks here
|
||||
# For example: file size checks, specific file format validations, etc.
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
"ignoreMissingScript": true,
|
||||
"enableParallelism": true,
|
||||
"incremental": true,
|
||||
"shellCommand": "eslint ./ --cache",
|
||||
"shellCommand": "eslint ./ --cache --quiet",
|
||||
"allowWarningsInSuccessfulBuild": true,
|
||||
"summary": "⭐️️ Run lint command for each package",
|
||||
"safeForSimultaneousRushProcesses": true
|
||||
|
|
|
|||
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
* 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 OriginPkgRootWebpackPlugin from '@coze-arch/pkg-root-webpack-plugin-origin';
|
||||
type PkgRootWebpackPluginOptions = Record<string, unknown>;
|
||||
declare class PkgRootWebpackPlugin extends OriginPkgRootWebpackPlugin {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,19 @@
|
|||
"use strict";
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,25 +13,31 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { useState, type FC } from 'react';
|
||||
|
||||
import { groupBy } from 'lodash-es';
|
||||
import { ToolGroupKey, ToolKey } from '@coze-agent-ide/tool-config';
|
||||
import {
|
||||
type useRegisteredToolKeyConfigList,
|
||||
abilityKey2ModelFunctionConfigType,
|
||||
} from '@coze-agent-ide/tool';
|
||||
import { useBotSkillStore } from '@coze-studio/bot-detail-store/bot-skill';
|
||||
import { I18n } from '@coze-arch/i18n';
|
||||
import { IconCozCross } from '@coze-arch/coze-design/icons';
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Modal,
|
||||
IconButton,
|
||||
Space,
|
||||
} from '@coze-arch/coze-design';
|
||||
import {
|
||||
type Model,
|
||||
ModelFuncConfigStatus,
|
||||
ModelFuncConfigType,
|
||||
} from '@coze-arch/bot-api/developer_api';
|
||||
import { useBotSkillStore } from '@coze-studio/bot-detail-store/bot-skill';
|
||||
import { ToolGroupKey, ToolKey } from '@coze-agent-ide/tool-config';
|
||||
import {
|
||||
type useRegisteredToolKeyConfigList,
|
||||
abilityKey2ModelFunctionConfigType,
|
||||
} from '@coze-agent-ide/tool';
|
||||
import { mergeModelFuncConfigStatus } from '@coze-agent-ide/bot-editor-context-store';
|
||||
import { IconCozCross } from '@coze-arch/coze-design/icons';
|
||||
import { Button, Checkbox, Modal, IconButton, Space } from '@coze-arch/coze-design';
|
||||
|
||||
type IRegisteredToolKeyConfig = ReturnType<
|
||||
typeof useRegisteredToolKeyConfigList
|
||||
|
|
@ -196,6 +202,7 @@ export const checkModelAbility = (
|
|||
: ModelFuncConfigType.KnowledgeOnDemandCall
|
||||
];
|
||||
modelFunctionConfigStatus = mergeModelFuncConfigStatus(
|
||||
// @ts-expect-error fix me late
|
||||
autoConfigStatus,
|
||||
modelFunctionConfigStatus,
|
||||
);
|
||||
|
|
@ -263,6 +270,7 @@ export const confirm = ({
|
|||
};
|
||||
|
||||
const getGroupTittleByConfigType = (type: ModelFuncConfigType): string =>
|
||||
// @ts-expect-error fix me late
|
||||
({
|
||||
[ModelFuncConfigType.Plugin]: I18n.t('bot_edit_type_skills'),
|
||||
[ModelFuncConfigType.Workflow]: I18n.t('bot_edit_type_skills'),
|
||||
|
|
@ -291,6 +299,7 @@ const getGroupTittleByConfigType = (type: ModelFuncConfigType): string =>
|
|||
})[type];
|
||||
|
||||
const getTitleByConfigType = (type: ModelFuncConfigType): string =>
|
||||
// @ts-expect-error fix me late
|
||||
({
|
||||
[ModelFuncConfigType.Plugin]: I18n.t('Plugins'),
|
||||
[ModelFuncConfigType.Workflow]: I18n.t('Workflows'),
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import path from 'path';
|
||||
|
||||
import {
|
||||
|
|
@ -65,7 +65,22 @@ const updateDTS = ({
|
|||
// 创建一个新的文件,用来保存生成的类型定义
|
||||
const typeDefs = project.createSourceFile(
|
||||
outputFileName,
|
||||
`/* eslint-disable */
|
||||
`/*
|
||||
* 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.
|
||||
*/
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
// 基于${path.relative(baseDir, inputFileName)}自动生成,请勿手动修改`,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
// 基于src/index.ts自动生成,请勿手动修改
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import { I18n } from '@coze-arch/i18n';
|
||||
|
||||
|
|
@ -56,8 +56,16 @@ describe('Date', () => {
|
|||
expect(getCurrentTZ().utcOffset()).toBe(60 * 8);
|
||||
});
|
||||
it('#formatDate', () => {
|
||||
const date = formatDate(1718782764);
|
||||
expect(date).toBe('2024/06/19 15:39:24');
|
||||
// 使用固定的时间戳,但验证格式而不是具体的时区值
|
||||
const timestamp = 1718782764;
|
||||
const date = formatDate(timestamp);
|
||||
// 验证格式是否正确:YYYY/MM/DD HH:mm:ss
|
||||
expect(date).toMatch(/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}$/);
|
||||
|
||||
// 验证时间戳转换的一致性:格式化后再解析应该得到相同的dayjs对象的日期部分
|
||||
const formattedDayjs = dayjs(date, 'YYYY/MM/DD HH:mm:ss');
|
||||
const originalDayjs = dayjs.unix(timestamp);
|
||||
expect(formattedDayjs.unix()).toBe(originalDayjs.unix());
|
||||
});
|
||||
it('#getRemainTime', () => {
|
||||
vi.useFakeTimers();
|
||||
|
|
@ -80,7 +88,7 @@ describe('Date', () => {
|
|||
describe('format timestamp', () => {
|
||||
beforeEach(() => {
|
||||
const MOCK_NOW = dayjs('2024-09-24 20:00:00');
|
||||
vi.setSystemTime(MOCK_NOW);
|
||||
vi.setSystemTime(MOCK_NOW.toDate());
|
||||
});
|
||||
|
||||
it('just now', () => {
|
||||
|
|
|
|||
|
|
@ -18,4 +18,12 @@ module.exports = defineConfig({
|
|||
},
|
||||
],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['src/**/namespaces/*.ts'],
|
||||
rules: {
|
||||
'unicorn/filename-case': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable unicorn/filename-case
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
|
|
@ -13,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
// @ts-nocheck
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { type TableMemoryItem } from '@coze-studio/bot-detail-store';
|
||||
import {
|
||||
|
|
@ -22,7 +22,6 @@ import {
|
|||
} from '@coze-data/database-v2-base/constants';
|
||||
import { DatabaseFieldTitle } from '@coze-data/database-v2-base/components/database-field-title';
|
||||
import { I18n } from '@coze-arch/i18n';
|
||||
import { FieldItemType } from '@coze-arch/bot-api/memory';
|
||||
import { IconCozEdit, IconCozTrashCan } from '@coze-arch/coze-design/icons';
|
||||
import {
|
||||
type ColumnProps,
|
||||
|
|
@ -31,12 +30,14 @@ import {
|
|||
Space,
|
||||
Typography,
|
||||
} from '@coze-arch/coze-design';
|
||||
import { FieldItemType } from '@coze-arch/bot-api/memory';
|
||||
|
||||
import { type TableRow, type TableField, type TableFieldData } from './type';
|
||||
|
||||
export function formatTableStructList(
|
||||
structList: TableMemoryItem[],
|
||||
): TableFieldData[] {
|
||||
// @ts-expect-error fix me late
|
||||
return structList.map(item => ({
|
||||
fieldName: item.name ?? '',
|
||||
fieldDescription: item.desc ?? '',
|
||||
|
|
@ -173,6 +174,7 @@ export const getTableColumns = ({
|
|||
title: () => (
|
||||
<DatabaseFieldTitle
|
||||
field={item.name}
|
||||
// @ts-expect-error fix me late
|
||||
type={item.type}
|
||||
tip={item.desc}
|
||||
required
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
|
@ -25,7 +25,6 @@ import {
|
|||
} from '@coze-data/database-v2-base/constants';
|
||||
import { DatabaseFieldTitle } from '@coze-data/database-v2-base/components/database-field-title';
|
||||
import { I18n } from '@coze-arch/i18n';
|
||||
import { FieldItemType, TableType } from '@coze-arch/bot-api/memory';
|
||||
import {
|
||||
CozInputNumber,
|
||||
type DatePickerProps,
|
||||
|
|
@ -37,6 +36,7 @@ import {
|
|||
withField,
|
||||
type CommonFieldProps,
|
||||
} from '@coze-arch/coze-design';
|
||||
import { FieldItemType, TableType } from '@coze-arch/bot-api/memory';
|
||||
|
||||
import {
|
||||
type TableRow,
|
||||
|
|
@ -250,6 +250,7 @@ function getSystemFieldCommonProps(field: TableMemoryItem): FieldCommonProps {
|
|||
<DatabaseFieldTitle
|
||||
field={field.name}
|
||||
textType="primary"
|
||||
// @ts-expect-error fix me late
|
||||
type={field.type}
|
||||
tip={field.desc}
|
||||
required
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import {
|
||||
|
|
@ -79,6 +79,7 @@ export const SpanInfoArea = (props: SpanInfoAreaProps) => {
|
|||
const { rootSpan, spans } = useSpanTransform({
|
||||
orgSpans: orgDetailSpans ?? [],
|
||||
traceAdvanceInfo,
|
||||
// @ts-expect-error fix me late
|
||||
spanCategoryMeta: spanCategory,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
"stories",
|
||||
"./src/**/*.test.ts",
|
||||
"vitest.config.ts",
|
||||
"setup-vitest.ts"
|
||||
"setup-vitest.ts",
|
||||
"__mocks__/*.ts"
|
||||
],
|
||||
"exclude": ["./dist"],
|
||||
"references": [
|
||||
|
|
|
|||
|
|
@ -13,5 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export function useInitOpenPremiumManage(_props: { open: () => void }) {}
|
||||
|
||||
export function useInitOpenPremiumManage(_props: { open: () => void }) {
|
||||
// allow empty function
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { merge } from 'lodash-es';
|
||||
import {
|
||||
REPORT_EVENTS as ReportEventNames,
|
||||
|
|
@ -87,6 +87,7 @@ export const getBotDetailDtoInfo = () => {
|
|||
onboarding_info: botSkill.transformVo2Dto.onboarding(onboardingContent),
|
||||
background_image_info_list: backgroundImageInfoList,
|
||||
shortcut_sort: botSkill.transformVo2Dto.shortcut(shortcut),
|
||||
// @ts-expect-error fix me late
|
||||
voices_info: merge(
|
||||
{},
|
||||
botSkill.transformVo2Dto.tts(tts),
|
||||
|
|
|
|||
|
|
@ -13,10 +13,9 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { nanoid } from 'nanoid';
|
||||
import { isNumber, mapValues } from 'lodash-es';
|
||||
import { type ShortCutStruct } from '@coze-agent-ide/tool-config';
|
||||
import {
|
||||
type PluginStatus,
|
||||
type PluginType,
|
||||
|
|
@ -50,6 +49,7 @@ import {
|
|||
DisablePromptCalling,
|
||||
} from '@coze-arch/bot-api/playground_api';
|
||||
import { SuggestReplyMode } from '@coze-arch/bot-api/developer_api';
|
||||
import { type ShortCutStruct } from '@coze-agent-ide/tool-config';
|
||||
|
||||
import {
|
||||
type WorkFlowItemType,
|
||||
|
|
@ -369,6 +369,7 @@ export const transformVo2Dto = {
|
|||
databaseList: (
|
||||
databaseList: DatabaseList,
|
||||
): BotInfoForUpdate['database_list'] =>
|
||||
// @ts-expect-error fix me late
|
||||
databaseList.map(d => ({
|
||||
table_id: d.tableId,
|
||||
table_name: d.name,
|
||||
|
|
|
|||
|
|
@ -13,21 +13,19 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { type PropsWithChildren } from 'react';
|
||||
|
||||
import {
|
||||
PictureUpload,
|
||||
type RenderAutoGenerateParams,
|
||||
} from '@coze-common/biz-components/picture-upload';
|
||||
import {
|
||||
type DraftProjectCopyRequest,
|
||||
type DraftProjectUpdateRequest,
|
||||
type DraftProjectCreateRequest,
|
||||
} from '@coze-arch/idl/intelligence_api';
|
||||
import { I18n } from '@coze-arch/i18n';
|
||||
import { FileBizType, IconType } from '@coze-arch/bot-api/developer_api';
|
||||
import {
|
||||
PictureUpload,
|
||||
type RenderAutoGenerateParams,
|
||||
} from '@coze-common/biz-components/picture-upload';
|
||||
import { botInputLengthService } from '@coze-agent-ide/bot-input-length-limit';
|
||||
import { IconCozUpload } from '@coze-arch/coze-design/icons';
|
||||
import {
|
||||
type BaseFormProps,
|
||||
|
|
@ -37,6 +35,8 @@ import {
|
|||
useFormApi,
|
||||
withField,
|
||||
} from '@coze-arch/coze-design';
|
||||
import { FileBizType, IconType } from '@coze-arch/bot-api/developer_api';
|
||||
import { botInputLengthService } from '@coze-agent-ide/bot-input-length-limit';
|
||||
|
||||
import { SwitchWithDesc } from '../switch-with-desc';
|
||||
import { type ModifyUploadValueType } from '../../type';
|
||||
|
|
@ -66,6 +66,7 @@ export const ProjectForm: React.FC<PropsWithChildren<ProjectFormProps>> = ({
|
|||
...formProps
|
||||
}) => <Form<ProjectFormValues> {...formProps}>{children}</Form>;
|
||||
|
||||
// @ts-expect-error fix me late
|
||||
export const filedKeyMap: Record<
|
||||
keyof ProjectFormValues,
|
||||
keyof ProjectFormValues
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable unicorn/filename-case */
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
|
|
@ -13,8 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable unicorn/filename-case */
|
||||
|
||||
import { type ViewVariableType } from '@coze-workflow/base';
|
||||
|
||||
import { useNodeAvailableVariablesWithNode } from '../../hooks/use-node-available-variables';
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
import { type WorkflowDatabase, ViewVariableType } from '@coze-workflow/base';
|
||||
import { FieldItemType, type DatabaseInfo } from '@coze-arch/bot-api/memory';
|
||||
|
|
@ -54,6 +54,7 @@ function transformRawDatabaseToDatabase(
|
|||
fields: rawDatabase.field_list?.map(field => ({
|
||||
id: field.alterId as number,
|
||||
name: field.name,
|
||||
// @ts-expect-error fix me late
|
||||
type: fieldItemTypeToViewVariableType(field.type),
|
||||
required: field.must_required,
|
||||
description: field.desc,
|
||||
|
|
|
|||
Loading…
Reference in New Issue