Coze源碼分析-資源庫-創建知識庫-前端源碼-核心組件

概述

本文深入分析Coze Studio中用戶創建知識庫功能的前端實現。該功能允許用戶在資源庫中創建、編輯和管理知識庫資源,為開發者提供了強大的知識管理和數據處理能力。通過對源碼的詳細解析,我們將了解從資源庫入口到知識庫配置彈窗的完整架構設計、組件實現、狀態管理和用戶體驗優化等核心技術要點。

功能特性

核心功能

  • 知識庫創建:支持自定義知識庫名稱、描述和圖標配置
  • 知識庫管理:提供知識庫列表展示、編輯和刪除功能
  • 多種知識庫類型:支持文本、表格、圖片三種格式類型
  • 數據源配置:支持本地上傳、在線導入等多種數據來源
  • 狀態管理:支持知識庫啟用/禁用狀態切換

用戶體驗特性

  • 即時反饋:操作結果實時展示和驗證
  • 表單驗證:完善的知識庫信息驗證機制
  • 便捷操作:支持一鍵創建并上傳、快速編輯
  • 國際化支持:多語言界面適配

技術架構

整體架構設計

┌─────────────────────────────────────────────────────────────┐
│                      知識庫管理模塊                          │
├─────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐  │
│  │ LibraryPage │  │LibraryHeader│  │CreateKnowledge      │  │
│  │ (資源庫頁面) │  │ (添加按鈕)  │  │     ModalV2         │  │
│  └─────────────┘  └─────────────┘  │  (創建/編輯彈窗)    │  │
│  ┌─────────────┐  ┌─────────────┐  └─────────────────────┘  │
│  │BaseLibrary  │  │   Table     │  ┌─────────────────────┐  │
│  │    Page     │  │ (資源列表)  │  │CozeKnowledgeAdd     │  │
│  └─────────────┘  └─────────────┘  │TypeContent(表單組件)│  │
│                                    └─────────────────────┘  │
├─────────────────────────────────────────────────────────────┤
│                      狀態管理層                             │
│  ┌─────────────────┐  ┌─────────────────────────────────┐  │
│  │useKnowledgeConfig│  │         API Hooks               │  │
│  │  (配置邏輯)      │  │       KnowledgeApi              │  │
│  └─────────────────┘  └─────────────────────────────────┘  │
├─────────────────────────────────────────────────────────────┤
│                       API服務層                            │
│  ┌─────────────────────────────────────────────────────────┐
│  │              Knowledge API                              │
│  │         CreateDataset/DeleteDataset/UpdateDataset      │
│  └─────────────────────────────────────────────────────────┘
└────────────────────────────────────────────────────────────┘

核心模塊結構

frontend/
├── apps/coze-studio/src/
│   └── pages/
│       ├── library.tsx            # 資源庫入口頁面
│       └── knowledge/
│           ├── layout.tsx         # 知識庫頁面布局
│           ├── page.tsx           # 知識庫詳情頁面
│           └── upload/            # 知識庫上傳相關
├── packages/studio/workspace/
│   ├── entry-adapter/src/pages/library/
│   │   └── index.tsx              # LibraryPage適配器組件
│   └── entry-base/src/pages/library/
│       ├── index.tsx              # BaseLibraryPage核心組件
│       ├── components/
│       │   └── library-header.tsx # LibraryHeader頭部組件
│       └── hooks/use-entity-configs/
│           └── use-knowledge-config.tsx  # 知識庫配置Hook
├── packages/data/knowledge/
│   ├── knowledge-modal-adapter/src/
│   │   └── create-knowledge-modal-v2/
│   │       └── scenes/base/
│   │           └── index.tsx      # useCreateKnowledgeModalV2 Hook
│   ├── knowledge-modal-base/src/
│   │   └── create-knowledge-modal-v2/
│   │       └── features/add-type-content/
│   │           └── coze-knowledge/
│   │               └── index.tsx  # CozeKnowledgeAddTypeContent組件
│   └── knowledge-stores/src/
│       └── hooks.ts               # 知識庫狀態管理Hook
├── packages/arch/idl/src/auto-generated/
│   └── knowledge/
│       └── namespaces/
│           └── knowledge.ts       # 知識庫相關類型定義
└── packages/arch/bot-api/src/└── knowledge-api.ts           # KnowledgeApi定義

用戶創建知識庫流程概述

用戶登錄Coze Studio↓點擊"資源庫"菜單↓LibraryPage 組件加載↓點擊右上角"+"按鈕↓LibraryHeader 顯示創建菜單↓點擊"知識庫"選項↓openCreateKnowledgeModal() 觸發↓CreateKnowledgeModalV2 彈窗顯示↓用戶選擇知識庫格式類型(文本/表格/圖片)↓用戶輸入知識庫名稱(name字段)↓用戶輸入知識庫描述(description字段)↓用戶選擇數據導入類型和上傳圖標↓表單驗證(名稱必填,描述可選)↓用戶點擊"創建"或"創建并導入"按鈕↓createDataset() 觸發↓KnowledgeApi.CreateDataset() 調用↓后端創建新知識庫資源↓onFinish() 處理成功響應↓導航到知識庫詳情頁面(可選擇是否進入上傳頁面)↓刷新資源庫列表

該流程包含多層驗證和處理:

  1. 前端表單驗證:通過Form組件進行名稱等必填字段驗證
  2. 知識庫類型選擇:支持文本、表格、圖片三種格式類型
  3. API調用:使用KnowledgeApi.CreateDataset API處理知識庫創建
  4. 成功處理:創建成功后可選擇直接進入上傳頁面或知識庫詳情頁面
  5. 狀態管理:通過useKnowledgeConfig Hook管理彈窗狀態和數據流
    整個流程確保了知識庫創建的便捷性和用戶體驗的流暢性。

核心組件實現

組件層次結構

知識庫創建功能涉及多個層次的組件:

  1. LibraryPage組件:資源庫主頁面
  2. BaseLibraryPage組件:資源庫核心邏輯
  3. LibraryHeader組件:包含創建按鈕的頭部
  4. CreateKnowledgeModalV2組件:知識庫配置彈窗
  5. CozeKnowledgeAddTypeContent組件:知識庫表單組件

1. 資源庫入口組件(LibraryPage)

文件位置:frontend/packages/studio/workspace/entry-adapter/src/pages/library/index.tsx

作為資源庫的適配器組件,整合各種資源配置:

import { type FC, useRef } from 'react';import {BaseLibraryPage,useDatabaseConfig,usePluginConfig,useWorkflowConfig,usePromptConfig,useKnowledgeConfig,
} from '@coze-studio/workspace-base/library';export const LibraryPage: FC<{ spaceId: string }> = ({ spaceId }) => {const basePageRef = useRef<{ reloadList: () => void }>(null);const configCommonParams = {spaceId,reloadList: () => {basePageRef.current?.reloadList();},};const { config: pluginConfig, modals: pluginModals } =usePluginConfig(configCommonParams);const { config: workflowConfig, modals: workflowModals } =useWorkflowConfig(configCommonParams);const { config: knowledgeConfig, modals: knowledgeModals } =useKnowledgeConfig(configCommonParams);const { config: promptConfig, modals: promptModals } =usePromptConfig(configCommonParams);const { config: databaseConfig, modals: databaseModals } =useDatabaseConfig(configCommonParams);return (<><BaseLibraryPagespaceId={spaceId}ref={basePageRef}entityConfigs={[pluginConfig,workflowConfig,knowledgeConfig,promptConfig,databaseConfig,]}/>{pluginModals}{workflowModals}{promptModals}{databaseModals}{knowledgeModals}</>);
};<ResultModalvisible={!!successData}data={successData}onOk={refresh}/></>);
};

設計亮點

  • 狀態集中管理:通過 usePatOperation Hook統一管理組件狀態
  • 組件解耦:各子組件職責明確,通過props進行通信
  • 數據流清晰:單向數據流,狀態變更可追蹤

2. 資源庫核心組件(BaseLibraryPage)

文件位置:frontend/packages/studio/workspace/entry-base/src/pages/library/index.tsx

負責資源庫的核心展示邏輯:

import { forwardRef, useImperativeHandle } from 'react';import classNames from 'classnames';
import { useInfiniteScroll } from 'ahooks';
import { I18n } from '@coze-arch/i18n';
import {Table,Select,Search,Layout,Cascader,Space,
} from '@coze-arch/coze-design';
import { renderHtmlTitle } from '@coze-arch/bot-utils';
import { EVENT_NAMES, sendTeaEvent } from '@coze-arch/bot-tea';
import {type ResType,type LibraryResourceListRequest,type ResourceInfo,
} from '@coze-arch/idl/plugin_develop';
import { PluginDevelopApi } from '@coze-arch/bot-api';import { type ListData, type BaseLibraryPageProps } from './types';
import { LibraryHeader } from './components/library-header';export const BaseLibraryPage = forwardRef<{ reloadList: () => void },BaseLibraryPageProps
>(({ spaceId, isPersonalSpace = true, entityConfigs }, ref) => {const { params, setParams, resetParams, hasFilter, ready } =useCachedQueryParams({spaceId,});const listResp = useInfiniteScroll<ListData>(async prev => {if (!ready) {return {list: [],nextCursorId: undefined,hasMore: false,};}const resp = await PluginDevelopApi.LibraryResourceList(entityConfigs.reduce<LibraryResourceListRequest>((res, config) => config.parseParams?.(res) ?? res,{...params,cursor: prev?.nextCursorId,space_id: spaceId,size: LIBRARY_PAGE_SIZE,},),);return {list: resp?.resource_list || [],nextCursorId: resp?.cursor,hasMore: !!resp?.has_more,};},{reloadDeps: [params, spaceId],},);useImperativeHandle(ref, () => ({reloadList: listResp.reload,}));return (<LayoutclassName={s['layout-content']}title={renderHtmlTitle(I18n.t('navigation_workspace_library'))}><Layout.Header className={classNames(s['layout-header'], 'pb-0')}><div className="w-full"><LibraryHeader entityConfigs={entityConfigs} />{/* 過濾器組件 */}</div></Layout.Header><Layout.Content>{/* 表格和列表內容 */}</Layout.Content></Layout>);}
);

3. 資源庫頭部組件(LibraryHeader)

文件位置:frontend/packages/studio/workspace/entry-base/src/pages/library/components/library-header.tsx

包含創建資源的入口按鈕:

import React from 'react';import { I18n } from '@coze-arch/i18n';
import { IconCozPlus } from '@coze-arch/coze-design/icons';
import { Button, Menu } from '@coze-arch/coze-design';import { type LibraryEntityConfig } from '../types';export const LibraryHeader: React.FC<{entityConfigs: LibraryEntityConfig[];
}> = ({ entityConfigs }) => (<div className="flex items-center justify-between mb-[16px]"><div className="font-[500] text-[20px]">{I18n.t('navigation_workspace_library')}</div><Menuposition="bottomRight"className="w-120px mt-4px mb-4px"render={<Menu.SubMenu mode="menu">{entityConfigs.map(config => config.renderCreateMenu?.() ?? null)}</Menu.SubMenu>}><Buttontheme="solid"type="primary"icon={<IconCozPlus />}data-testid="workspace.library.header.create">{I18n.t('library_resource')}</Button></Menu></div>
);

4. 知識庫配置Hook(useKnowledgeConfig)

文件位置:frontend/packages/studio/workspace/entry-base/src/pages/library/hooks/use-entity-configs/use-knowledge-config.tsx

管理知識庫創建和編輯的狀態:

import { useNavigate } from 'react-router-dom';import { useRequest } from 'ahooks';
import { useCreateKnowledgeModalV2 } from '@coze-data/knowledge-modal-adapter';
import {ActionKey,type ResourceInfo,ResType,
} from '@coze-arch/idl/plugin_develop';
import { DatasetStatus } from '@coze-arch/idl/knowledge';
import { I18n, type I18nKeysNoOptionsType } from '@coze-arch/i18n';
import { IconCozClock, IconCozKnowledge } from '@coze-arch/coze-design/icons';
import { Menu, Switch, Tag, Toast, Table } from '@coze-arch/coze-design';
import { KnowledgeApi } from '@coze-arch/bot-api';
import { safeJSONParse } from '@coze-agent-ide/space-bot/util';import { BaseLibraryItem } from '../../components/base-library-item';
import DocDefaultIcon from '../../assets/doc_default_icon.png';
import { type UseEntityConfigHook } from './types';const { TableAction } = Table;/*** Knowledge base tags:* 0-text* 1-table* 2-image* */
const knowledgeSubTypeTextMap: Record<number, I18nKeysNoOptionsType> = {0: 'library_filter_tags_text',1: 'library_filter_tags_table',2: 'library_filter_tags_image',
};export const useKnowledgeConfig: UseEntityConfigHook = ({spaceId,reloadList,getCommonActions,
}) => {const navigate = useNavigate();const {modal: createKnowledgeModal,open: openCreateKnowledgeModal,close: closeCreateKnowledgeModal,} = useCreateKnowledgeModalV2({onFinish: (datasetID, unitType, shouldUpload) => {navigate(`/space/${spaceId}/knowledge/${datasetID}${shouldUpload ? '/upload' : ''}?type=${unitType}&from=create`,);closeCreateKnowledgeModal();},});// deleteconst { run: delKnowledge } = useRequest((datasetId: string) =>KnowledgeApi.DeleteDataset({dataset_id: datasetId,}),{manual: true,onSuccess: () => {reloadList();Toast.success(I18n.t('Delete_success'));},},);return {modals: <>{createKnowledgeModal}</>,config: {typeFilter: {label: I18n.t('library_resource_type_knowledge'),value: ResType.Knowledge,},renderCreateMenu: () => (<Menu.Itemdata-testid="workspace.library.header.create.knowledge"icon={<IconCozKnowledge />}onClick={openCreateKnowledgeModal}>{I18n.t('library_resource_type_knowledge')}</Menu.Item>),target: [ResType.Knowledge],onItemClick: (item: ResourceInfo) => {navigate(`/space/${spaceId}/knowledge/${item.res_id}?from=library`);},renderItem: item => (<BaseLibraryItemresourceInfo={item}defaultIcon={DocDefaultIcon}tag={<>{safeJSONParse(item.biz_extend?.processing_file_id_list)?.length ? (<Tagdata-testid="workspace.library.item.tag"color="brand"size="mini"className="flex-shrink-0 flex-grow-0"prefixIcon={<IconCozClock />}>{I18n.t('library_filter_tags_processing')}</Tag>) : null}{item.res_sub_type !== undefined &&knowledgeSubTypeTextMap[item.res_sub_type] ? (<Tagdata-testid="workspace.library.item.tag"color="brand"size="mini"className="flex-shrink-0 flex-grow-0">{I18n.t(knowledgeSubTypeTextMap[item.res_sub_type])}</Tag>) : null}</>}/>),renderActions: (item: ResourceInfo) => {const deleteDisabled = !item.actions?.find(action => action.key === ActionKey.Delete,)?.enable;const deleteProps = {disabled: deleteDisabled,deleteDesc: I18n.t('library_delete_desc'),handler: () => {delKnowledge(item.res_id || '');},};return (<TableActiondeleteProps={deleteProps}actionList={getCommonActions?.(item) ?? []}/>);},},};
};

5. 知識庫配置彈窗(useCreateKnowledgeModalV2)

文件位置:frontend/packages/data/knowledge/knowledge-modal-adapter/src/create-knowledge-modal-v2/scenes/base/index.tsx

知識庫創建的主要Hook和界面:

import { useRef, useState } from 'react';import { useDataModalWithCoze } from '@coze-data/utils';
import { useDataNavigate } from '@coze-data/knowledge-stores';
import { UnitType } from '@coze-data/knowledge-resource-processor-core';
import {CozeKnowledgeAddTypeContent,type CozeKnowledgeAddTypeContentFormData,
} from '@coze-data/knowledge-modal-base/create-knowledge-modal-v2';
import { KnowledgeE2e } from '@coze-data/e2e';
import { I18n } from '@coze-arch/i18n';
import { Button, Form, LoadingButton } from '@coze-arch/coze-design';
import { useSpaceStore } from '@coze-arch/bot-studio-store';
import { FormatType } from '@coze-arch/bot-api/knowledge';
import { KnowledgeApi } from '@coze-arch/bot-api';export interface UseCreateKnowledgeModalParams {projectID?: string;onFinish?: (datasetId: string, type: UnitType, shouldUpload: boolean) => void;beforeCreate?: (shouldUpload: boolean) => void;
}export const useCreateKnowledgeModalV2 = (params: UseCreateKnowledgeModalParams = {},
) => {const { onFinish, beforeCreate, projectID } = params;const formRef = useRef<Form<CozeKnowledgeAddTypeContentFormData>>(null);const [currentFormatType, setCurrentFormatType] = useState(FormatType.Text);const spaceId = useSpaceStore(store => store.getSpaceId());const resourceNavigate = useDataNavigate();const [unitType, setUnitType] = useState<UnitType>(UnitType.TEXT_DOC);const createDataset = async () => {await formRef.current?.formApi.validate();const { dataset_id: datasetId } = await KnowledgeApi.CreateDataset({project_id: projectID || undefined,name: formRef.current?.formApi.getValue('name'),format_type: currentFormatType,description: formRef.current?.formApi.getValue('description'),icon_uri: formRef.current?.formApi.getValue('icon_uri')?.[0].uid,space_id: spaceId || undefined,});return datasetId;};const { open, close, modal } = useDataModalWithCoze({title: (<div data-testid={KnowledgeE2e.CreateKnowledgeModalTitle}>{I18n.t('datasets_model_create_title')}</div>),centered: true,onCancel: () => {close();},footer: (<div className="flex w-full justify-end"><Buttoncolor="primary"onClick={() => {close();}}>{I18n.t('cancel')}</Button><LoadingButtoncolor="primary"onClick={async () => {beforeCreate?.(false);const datasetId = await createDataset();if (onFinish) {onFinish(datasetId || '', unitType, false);} else {resourceNavigate.toResource?.('knowledge', datasetId);}}}>{I18n.t('kl_write_108')}</LoadingButton><LoadingButtondata-testid={KnowledgeE2e.CreateKnowledgeModalSubmitAndImportButton}color="primary"onClick={async () => {beforeCreate?.(true);const datasetId = await createDataset();if (onFinish) {onFinish(datasetId || '', unitType, true);} else {resourceNavigate.upload?.({ type: unitType });}}}>{I18n.t('kl_write_109')}</LoadingButton></div>),});return {modal: modal(<Form<CozeKnowledgeAddTypeContentFormData>ref={formRef}showValidateIcon={false}><CozeKnowledgeAddTypeContentonImportKnowledgeTypeChange={setUnitType}onSelectFormatTypeChange={setCurrentFormatType}/></Form>,),open: () => {setCurrentFormatType(FormatType.Text);open();},close,};
};

設計亮點

  • 狀態集中管理:通過 useCreateKnowledgeModalV2 Hook統一管理知識庫創建狀態
  • 組件解耦:各子組件職責明確,通過props進行通信
  • 數據流清晰:單向數據流,狀態變更可追蹤
  • 用戶體驗優化:支持兩種創建模式(僅創建/創建并導入)
  • 表單驗證完善:支持表單驗證和實時反饋

6. 知識庫表單組件(CozeKnowledgeAddTypeContent)

文件位置:frontend/packages/data/knowledge/knowledge-modal-base/src/create-knowledge-modal-v2/features/add-type-content/coze-knowledge/index.tsx

知識庫創建表單的核心組件:

import { useEffect, useState } from 'react';import { CozeFormTextArea, CozeInputWithCountField } from '@coze-data/utils';
import { UnitType } from '@coze-data/knowledge-resource-processor-core';
import { KnowledgeE2e } from '@coze-data/e2e';
import { PictureUpload } from '@coze-common/biz-components/picture-upload';
import { I18n } from '@coze-arch/i18n';
import { FormatType } from '@coze-arch/bot-api/knowledge';
import { type Icon } from '@coze-arch/bot-api/knowledge';
import { FileBizType, IconType } from '@coze-arch/bot-api/developer_api';
import { KnowledgeApi } from '@coze-arch/bot-api';
import { useFormApi } from '@coze-arch/coze-design';export interface CozeKnowledgeAddTypeContentFormData {name: string;icon_uri?: Array<{url: string;uri: string;uid: string;isDefault?: boolean;}>;format_type: FormatType;description: string;
}export const CozeKnowledgeAddTypeContent = (params: AddTypeContentProps) => {const { onImportKnowledgeTypeChange, onSelectFormatTypeChange } = params;const formApi = useFormApi<CozeKnowledgeAddTypeContentFormData>();const [currentFormatType, setCurrentFormatType] = useState(FormatType.Text);const [iconInfoGenerate, setIconInfoGenerate] = useState<{name: string;desc: string;}>({name: '',desc: '',});const [coverIcon, setCoverIcon] = useState<Icon | undefined>({uri: '',url: '',});const fetchIcon = async (formatType: FormatType) => {const { icon } = await KnowledgeApi.GetIcon({format_type: formatType,});setCoverIcon(icon);const currentCover = formApi.getValue('icon_uri');if (!currentCover || currentCover[0]?.isDefault) {formApi.setValue('icon_uri', [{url: icon?.url ?? '',uri: icon?.uri ?? '',uid: icon?.uri ?? '',isDefault: true,},]);}};const [unitType, setUnitType] = useState<UnitType>(UnitType.TEXT_DOC);useEffect(() => {fetchIcon(currentFormatType);if (currentFormatType === FormatType.Text) {setUnitType(UnitType.TEXT_DOC);} else if (currentFormatType === FormatType.Table) {setUnitType(UnitType.TABLE_DOC);} else if (currentFormatType === FormatType.Image) {setUnitType(UnitType.IMAGE_FILE);}}, [currentFormatType]);return (<div data-testid={KnowledgeE2e.CreateKnowledgeModal}><SelectFormatTypefield="format_type"noLabelonChange={(type: FormatType) => {setCurrentFormatType(type);formApi.setValue('format_type', type);onSelectFormatTypeChange?.(type);}}/><CozeInputWithCountFielddata-testid={KnowledgeE2e.CreateKnowledgeModalNameInput}field="name"label={I18n.t('datasets_model_create_name')}maxLength={100}rules={[{required: true,whitespace: true,message: I18n.t('dataset-name-empty-tooltip'),},{pattern: /^[^"'`\\]+$/,message: I18n.t('dataset-name-has-wrong-word-tooltip'),},]}placeholder={I18n.t('datasets_model_create_name_placeholder')}/><CozeFormTextAreafield="description"data-testid={KnowledgeE2e.CreateKnowledgeModalDescInput}label={I18n.t('datasets_model_create_description')}autosize={{ minRows: 1, maxRows: 2 }}maxCount={2000}maxLength={2000}placeholder={I18n.t('datasets_model_create_description_placeholder')}/><ImportKnowledgeSourceSelectformatType={currentFormatType}initValue={unitType}onChange={setUnitType}/><PictureUploadlabel={I18n.t('datasets_model_create_avatar')}field="icon_uri"testId={KnowledgeE2e.CreateKnowledgeModalAvatarUploader}fileBizType={FileBizType.BIZ_DATASET_ICON}iconType={IconType.Dataset}generateInfo={iconInfoGenerate}/></div>);
};

設計亮點

  • 多格式支持:支持文本、表格、圖片三種知識庫格式類型
  • 智能圖標生成:根據知識庫名稱和描述自動生成圖標
  • 表單驗證完善:支持名稱格式驗證和字符長度限制
  • 數據源選擇:支持多種數據導入類型選擇
  • 用戶體驗優化:支持實時預覽和智能提示

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/bicheng/96765.shtml
繁體地址,請注明出處:http://hk.pswp.cn/bicheng/96765.shtml
英文地址,請注明出處:http://en.pswp.cn/bicheng/96765.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

基于時空數據的網約車訂單需求預測與調度優化

一、引言隨著共享出行行業的蓬勃發展&#xff0c;網約車已成為城市交通的重要組成部分。如何精準預測訂單需求并優化車輛調度&#xff0c;是提升平臺運營效率、改善用戶體驗的關鍵。本文提出一種基于時空數據的網約車訂單需求預測與調度優化方案&#xff0c;通過網格化城市空間…

數據結構 Java對象的比較

在Java中&#xff0c;凡是涉及到比較的&#xff0c;可以分為兩類情況&#xff1a;一類是基本數據類型的比較&#xff0c;另一類是引用數據類型的比較。對于基本數據類型的比較&#xff0c;我們通過關系運算符&#xff08;、>、<、!、>、<&#xff09;進行它們之間的…

企智匯建筑施工項目管理系統:全周期數字化管控,賦能工程企業降本增效!?建筑工程項目管理軟件!建筑工程項目管理系統!建筑項目管理軟件企智匯軟件

在建筑施工行業&#xff0c;項目進度滯后、成本超支、質量安全隱患頻發、多方協同不暢等問題&#xff0c;一直是制約企業發展的痛點。傳統依賴人工記錄、Excel 統計的管理模式&#xff0c;不僅效率低下&#xff0c;更易因信息斷層導致決策失誤。企智匯建筑施工項目管理系統憑借…

k8s-臨時容器學習

臨時容器學習1. 什么是臨時容器2. 實驗1. 什么是臨時容器 在官網&#xff1a;https://kubernetes.io/zh-cn/docs/concepts/workloads/pods/ephemeral-containers/ 中有介紹 臨時容器是用于調試Pod中崩潰的容器或者不具備調試工具&#xff0c;比如在一個運行著業務的容器中&am…

Python 2025:低代碼開發與自動化運維的新紀元

從智能運維到無代碼應用&#xff0c;Python正在重新定義企業級應用開發范式在2025年的企業技術棧中&#xff0c;Python已經從一個"開發工具"演變為業務自動化的核心平臺。根據Gartner 2025年度報告&#xff0c;68%的企業在自動化項目中使用Python作為主要開發語言&am…

Netty 在 API 網關中的應用篇(請求轉發、限流、路由、負載均衡)

Netty 在 API 網關中的應用篇&#xff08;請求轉發、限流、路由、負載均衡&#xff09;隨著微服務架構的普及&#xff0c;API 網關成為服務之間通信和安全控制的核心組件。在構建高性能網關時&#xff0c;Netty 因其高吞吐、低延遲和異步非阻塞 IO 的特性&#xff0c;成為不少開…

基于STM32設計的青少年學習監控系統(華為云IOT)_282

文章目錄 一、前言 1.1 項目介紹 【1】項目開發背景 【2】設計實現的功能 【3】項目硬件模塊組成 【4】設計意義 【5】國內外研究現狀 【6】摘要 1.2 設計思路 1.3 系統功能總結 1.4 開發工具的選擇 【1】設備端開發 【2】上位機開發 1.5 參考文獻 1.6 系統框架圖 1.7 系統原理…

手寫Spring底層機制的實現【初始化IOC容器+依賴注入+BeanPostProcesson機制+AOP】

摘要&#xff1a;建議先看“JAVA----Spring的AOP和動態代理”這個文章&#xff0c;解釋都在代碼中&#xff01;一&#xff1a;提出問題依賴注入1.單例beans.xml<?xml version"1.0" encoding"UTF-8"?> <beans xmlns"http://www.springframe…

5G NR-NTN協議學習系列:NR-NTN介紹(2)

NTN網絡作為依賴衛星的通信方式&#xff0c;需要面對的通信距離&#xff0c;通信雙方的移動速度都和之前TN網絡存在巨大差異。在距離方面相比蜂窩地面網絡Terrestrial Network通信距離從最小幾百米到最大幾十km的情況&#xff0c;NTN非地面網絡的通信距離即使是近地軌道的LEO衛…

線掃相機采集圖像起始位置不正確原因總結

1、幀觸發開始時間問題 問題描述: 由于幀觸發決定了線掃相機的開始采集圖像位置,比如正確的位置是A點開始采集,結果你從B點開始觸發幀信號,這樣出來的圖像起始位置就不對 解決手段: 軟件需要記錄幀觸發時軸的位置 1)控制卡控制軸 一般使用位置比較觸發,我們可以通過監…

校園管理系統練習項目源碼-前后端分離-【node版】

今天給大家分享一個校園管理系統&#xff0c;前后端分離項目。這是最近在練習前端編程&#xff0c;結合 node 寫的一個完整的項目。 使用的技術&#xff1a; Node.js&#xff1a;版本要求16.20以上。 后端框架&#xff1a;Express框架。 數據庫&#xff1a; MySQL 8.0。 Vue2&a…

【項目】 :C++ - 仿mudou庫one thread one loop式并發服務器實現(模塊劃分)

【項目】 &#xff1a;C - 仿mudou庫one thread one loop式并發服務器實現一、HTTP 服務器與 Reactor 模型1.1、HTTP 服務器概念實現步驟難點1.2、Reactor 模型概念分類1. 單 Reactor 單線程2. 單 Reactor 多線程3. 多 Reactor 多線程目標定位總結二、功能模塊劃分2.1、SERVER …

浴室柜市占率第一,九牧重構數智衛浴新生態

作者 | 曾響鈴文 | 響鈴說2025年上半年&#xff0c;家居市場在政策的推動下展現出獨特的發展態勢。國家出臺的一系列鼓勵家居消費的政策&#xff0c;如“以舊換新”國補政策帶動超6000萬件廚衛產品煥新&#xff0c;以及我國超2.7億套房齡超20年的住宅進入改造周期&#xff0c;都…

源碼分析之Leaflet中TileLayer

概述 TileLayer 是 Layer 的子類&#xff0c;繼承自GridLayer基類&#xff0c;用于加載和顯示瓦片地圖。它提供了加載和顯示瓦片地圖的功能&#xff0c;支持自定義瓦片的 URL 格式和參數。 源碼分析 源碼實現 TileLayer的源碼實現如下&#xff1a; export var TileLayer GridL…

php學習(第二天)

一.網站基本概念-服務器 1.什么是服務器? 1.1定義 服務器&#xff08;server&#xff09;,也稱伺服器&#xff0c;是提供計算服務的設備。 供計算服務的設備” 這里的“設備”不僅指物理機器&#xff08;如一臺配有 CPU、內存、硬盤的計算機&#xff09;&#xff0c;也可以指…

C++(友元和運算符重載)

目錄 友元&#xff1a; 友元函數&#xff1a; 示例&#xff1a; 友元類&#xff1a; 示例&#xff1a; 優點&#xff1a; 注意事項&#xff1a; 運算符重載&#xff1a; 注意&#xff1a; 示例&#xff1a; 友元&#xff1a; C中如果想要外部函數或者類對一個類的pr…

和平精英風格射擊游戲開發指南

本教程將完整講解如何開發一款和平精英風格的HTML射擊游戲&#xff0c;涵蓋核心設計理念、代碼架構與關鍵實現細節。 核心設計架構 游戲機制系統 角色控制系統&#xff1a;通過鍵盤實現玩家移動戰斗系統&#xff1a;子彈發射與碰撞檢測道具系統&#xff1a;武器、彈藥和醫療包收…

21.1 《24GB顯存搞定LLaMA2-7B指令微調:QLoRA+Flash Attention2.0全流程實戰》

24GB顯存搞定LLaMA2-7B指令微調:QLoRA+Flash Attention2.0全流程實戰 實戰 LLaMA2-7B 指令微調 一、指令微調技術背景 指令微調(Instruction Tuning)是大模型訓練中的關鍵技術突破點。與傳統全量微調(Full Fine-Tuning)相比,指令微調通過特定格式的指令-響應數據訓練,…

周志華《機器學習導論》第10章 降維與度量學習

https://www.lamda.nju.edu.cn/aml24fall/slides/Chap10.pptx 目錄 1.MDS (Multiple Dimensional Scaling) 多維縮放方法 2. 主成分分析 (Principal Component Analysis, PCA) 2.1 凸優化證明 2.2 人臉識別降維應用 3. 核化PCA 4. 流行學習 4.1 LLE 局部線性嵌入&#…

Kubernetes 彈性伸縮:深入講解 HPA 和 VPA

1. 介紹 Kubernetes 提供了多種資源管理方式&#xff0c;其中 彈性伸縮&#xff08;Auto-scaling&#xff09;是最重要的特性之一。彈性伸縮可以根據應用的負載變化自動調整 Pod 的數量和資源&#xff0c;以確保在高負載下應用能夠正常運行&#xff0c;而在低負載時節省資源。在…