vue3代碼規范管理;基于vite和vue3、 eslint、prettier、stylelint、husky規范;git觸發eslint校驗

前言

為提高前端代碼格式化和規范開發。主要使用eslint、prettier、husky完成對git提交commit信息校驗和代碼eslint格式化校驗,不符合要求的代碼,提交不到倉庫。


參考鏈接1
參考鏈接2

文章目錄

  • 前言
  • 一、效果圖
    • 1.git提交觸發eslint規范校驗
    • 2.版本與分支名不一致校驗
    • 3.commit提交不規范校驗
    • 4.代碼提交規范相關介紹
  • 二、Prettier準備
    • 1.安裝Prettier
    • 2.安裝對應插件
    • 3.配置
    • 4.配置格式化
    • 5.保存自動格式化代碼設置
  • 三、eslint準備
    • 1.安裝eslint插件
    • 2.勾選
    • 3.安裝eslint依賴
    • 4.根添加配置
    • 5.package.json添加校驗命令
  • 四、git檢查提交分支和package.json的version版本是否一致
    • 1.安裝命令husky和lint-staged
    • 2.初始化
    • 3.創建校驗腳本?
    • 4.配置ckage.json
    • 5.更新 Husky 鉤子?
    • 6.測試版本不一致的提交效果
  • 五、支持eslint.config.js的解析
    • 1.原生語法解析(無就jsx、無ts)
    • 2.有jsx無ts
    • 3.有jsx有ts
  • 六、git提交規范化類型
    • 1.package.json添加命令和初始化husky
    • 2.安裝
    • 3.配置git提交類型
    • 4.添加commit-msg
    • 5.測試git提交規范
  • 七、git提交觸發eslint
    • 1.package.json修改
    • 2.測試git提交觸發eslint
  • 八、最終結構
  • 九、eslint相關報錯

一、效果圖

1.git提交觸發eslint規范校驗

在這里插入圖片描述

2.版本與分支名不一致校驗

在這里插入圖片描述

3.commit提交不規范校驗

在這里插入圖片描述

4.代碼提交規范相關介紹

代碼格式規范相關:

  • eslint:代碼格式校驗
  • prettier:prettier 主要是為了格式化代碼,而在沒有 prettier 之前,是用 eslint —fix和 編輯器自帶代碼格式來進行代碼格式化的。
  • stylelint:css樣式格式校驗

代碼提交規范相關:

  • lint-staged:一個在git暫存文件上運行linters的工具,檢查本次修改更新的代碼,并自動修復并且可以添加到暫存區
  • husky: 是一個Git Hook 工具。將其安裝到所在倉庫的過程中它會自動在 .git/ 目錄下增加相應的鉤子實現對應的功能,這里我們通過使用husky監測commit-msg鉤子,完成提交信息校驗監測 pre-commit 鉤子,完成代碼校驗。
  • pre-commit:git hooks的鉤子,在代碼提交前檢查代碼是否符合規范,不符合規范將不可被提交
  • commit-msg:git hooks的鉤子,在代碼提交前檢查commit信息是否符合規范
  • commitizen:git的規范化提交工具,幫助你填寫commit信息,符合約定式提交要求
  • commitlint:用于檢測提交的信息。

文檔:

  • git規范提交文檔
  • stylelint
  • eslint

二、Prettier準備

1.安裝Prettier

Prettier是一個代碼格式化工具,它可以自動調整代碼的縮進、換行、引號等格式,使代碼風格保持一致。與ESLint不同,Prettier主要關注代碼的格式問題,而不是語法或邏輯錯誤。

npm install prettier --save-dev

package.json添加

  "scripts": {"prettier": "npx prettier . --write",},

2.安裝對應插件

在這里插入圖片描述

3.配置

.prettierignore忽略文件

.github
.husky
.vscode
/public/**
/node_modules/**
**/*.svg
**/*.sh

.prettierrc.cjs配置文件

module.exports = {printWidth: 200,tabWidth: 2,useTabs: false,semi: false,trailingComma: "none",singleQuote: false,bracketSpacing: true,jsxBracketSameLine: false,endOfLine: "auto",arrowParens: "avoid",singleAttributePerLine: false,htmlWhitespaceSensitivity: "ignore"
}

4.配置格式化

在vscode 的設置里面 找到代碼格式化設置,設置為使用 prettier格式化代碼
在這里插入圖片描述

5.保存自動格式化代碼設置

在這里插入圖片描述

三、eslint準備

1.安裝eslint插件

在這里插入圖片描述

2.勾選

在這里插入圖片描述

3.安裝eslint依賴

pnpm add @eslint/js@9.8.0 eslint@9.8.0 eslint-plugin-vue@9.27.0 globals@15.8.0 --save-dev

4.根添加配置

.eslintignore

*.sh
*.md
*.woff
*.ttf
.vscode
.husky
.githubnode_modules
dist

eslint.config.js: 添加這個文件后才可以支持eslnt觸發校驗
這個文件的配置,具體可以看文章最后的 五、支持eslint.config.js的解析 內容

import globals from "globals"
import pluginJs from "@eslint/js"
import pluginVue from "eslint-plugin-vue"export default [{ files: ["**/*.{js,mjs,cjs,vue}"] }, // 注意范圍{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },pluginJs.configs.recommended,...pluginVue.configs["flat/essential"],{files: ["**/*.vue"],rules: {"vue/html-self-closing": "off","vue/multi-word-component-names": "off","vue/max-attributes-per-line": "off","vue/singleline-html-element-content-newline": "off","max-lines": ["error", { max: 500, skipBlankLines: true, skipComments: true }]}},{ignores: ["node_modules/*", "dist/*", "public/*"]}
]

5.package.json添加校驗命令

5.1命令

  "scripts": {"prettier": "npx prettier . --write","lint": "npx eslint ."},

5.2執行npm run lint就會觸發eslint的校驗,看到eslint報錯。
在這里插入圖片描述

5.3同時頁面應該也可以看到eslint的報錯了。

  • 如果此時vscode看不到具體的頁面的eslint報錯,那就關閉項目,重啟vscode。
  • 如果發現做了上述操作之后,還是沒觸發,那就把vscode的 eslint、prettier 擴展插件 卸載了重新安裝,然后重啟vscode,就可以解決了
    在這里插入圖片描述

四、git檢查提交分支和package.json的version版本是否一致

詳細單獨配置版本檢查看此篇

husky操作git鉤子的工具
lint-staged在提交前進行eslint校驗,并使用prettier格式化暫存區的代碼
@commitlint/cli校驗提交信息
@commitlint/config-conventionalAngular 的提交規范
commitizen生成標準化的commit message
cz-git輕量級、高度自定義。輸出標準格式的commitize 適配器

新增內容:
在這里插入圖片描述

1.安裝命令husky和lint-staged

npm install husky@9.1.4 lint-staged@15.2.9 --save-dev

2.初始化

npx husky-init && pnpm install

生成 .husky 目錄及 pre-commit 鉤子文件

3.創建校驗腳本?

在項目根目錄新建 scripts/check-version.js:

import fs from "fs"
import { execSync } from "child_process"// 獲取packageJson內容
const packageJson = JSON.parse(fs.readFileSync("package.json", "utf8"))// 獲取當前分支名
const branchName = execSync("git rev-parse --abbrev-ref HEAD").toString().trim()if (!branchName.includes(packageJson.version)) {console.error(`版本 ${packageJson.version} 與分支名稱 ${branchName} 不一致,不允許提交`)process.exit(1)
}

4.配置ckage.json

配置lint-staged?,添加校驗:
注意此時僅僅校驗版本,沒有校驗eslint

  "scripts": {"prepare": "husky install"},"lint-staged": {"*.{js,jsx,ts,tsx}": ["prettier --write"],"*.vue": ["prettier --write"]}

5.更新 Husky 鉤子?

修改 .husky/pre-commit:

npx lint-staged
node scripts/check-version.js

6.測試版本不一致的提交效果

在這里插入圖片描述

五、支持eslint.config.js的解析

1.原生語法解析(無就jsx、無ts)

import globals from "globals"
import pluginJs from "@eslint/js"
import pluginVue from "eslint-plugin-vue"export default [{ files: ["**/*.{js,mjs,cjs,vue}"] }, // 注意范圍{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },pluginJs.configs.recommended,...pluginVue.configs["flat/essential"],{files: ["**/*.vue"],rules: {"vue/html-self-closing": "off","vue/multi-word-component-names": "off","vue/max-attributes-per-line": "off","vue/singleline-html-element-content-newline": "off","max-lines": ["error", { max: 500, skipBlankLines: true, skipComments: true }]}},{ignores: ["node_modules/*", "dist/*", "public/*"]}
]

2.有jsx無ts

報錯:jsx報錯Parsing error: Unexpected token <eslint
在這里插入圖片描述

安裝依賴

npm install vue-eslint-parser --save-dev
import globals from "globals"
import pluginJs from "@eslint/js"
import pluginVue from "eslint-plugin-vue"
import babelParser from "vue-eslint-parser"; // 顯式導入解析器對象-否則引入報錯export default [{files: ["**/*.{js,jsx,vue}"], // 注意范圍languageOptions: {// 正確引用解析器對象(非字符串)parser: babelParser,parserOptions: {ecmaVersion: "latest",sourceType: "module",ecmaFeatures: { jsx: true }},globals: { ...globals.browser, ...globals.node }}},pluginJs.configs.recommended,...pluginVue.configs["flat/essential"],{files: ["**/*.vue"],rules: {"vue/html-self-closing": "off","vue/multi-word-component-names": "off","vue/max-attributes-per-line": "off","vue/singleline-html-element-content-newline": "off","max-lines": ["error", { max: 500, skipBlankLines: true, skipComments: true }]}},{ignores: ["node_modules/*", "dist/*", "public/*"]}
]

3.有jsx有ts

  • 我的這里比較特殊,最初有jsx和ts代碼時候,沒有安裝@typescript-eslint/parser@typescript-eslint/eslint-plugin這兩個插件時候,ts的代碼是會報Parsing error: Unexpected token {eslint問題。
  • 但是當我安裝下面兩個依賴后,eslint.config.js繼續使用2.有jsx無ts的配置時,發現ts的報錯也沒了。。。
  • 原因:files: ["**/*.{js,jsx,ts,tsx,vue}"],漏了寫ts,tsx
  • 正確解決問題的方式如下

安裝依賴

npm install @typescript-eslint/parser @typescript-eslint/eslint-plugin --save-dev

注意:project: "./tsconfig.json"的路徑

import globals from "globals";
import pluginJs from "@eslint/js";
import pluginVue from "eslint-plugin-vue";
import vueParser from "vue-eslint-parser";
import tsParser from "@typescript-eslint/parser"; // 導入 TS 解析器
import tsEslintParser from "@typescript-eslint/eslint-plugin"; // 導入 TS 解析器export default [// 核心配置{files: ["**/*.{js,jsx,ts,tsx,vue}"], // 注意范圍languageOptions: {// 主解析器:處理 Vue 文件parser: vueParser,parserOptions: {// 子解析器:處理非 Vue 文件(TS/JS)parser: {js: tsParser, // 處理 JS/JSXts: tsParser, // 處理 TS/TSXjsx: tsParser,tsx: tsParser},ecmaVersion: "latest",sourceType: "module",ecmaFeatures: { jsx: true },// 關聯 tsconfig.json(路徑根據實際項目調整)project: "./tsconfig.json" // 【【【【【【【【【【【【【【【【【【【【【【【【【【【【【【【【【【注意這里路徑調整,沒有ts配置文件就注釋掉該行】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】},globals: { ...globals.browser, ...globals.node }}},// 應用推薦規則pluginJs.configs.recommended,// Vue3 配置...pluginVue.configs["flat/essential"],// TypeScript 配置{plugins: {"@typescript-eslint": tsEslintParser},rules: {// "@typescript-eslint/no-unused-vars": "warn" // 示例規則}},// 自定義規則{files: ["**/*.vue"],rules: {"vue/html-self-closing": "off","vue/multi-word-component-names": "off","vue/max-attributes-per-line": "off","vue/singleline-html-element-content-newline": "off","max-lines": ["error", { max: 500, skipBlankLines: true, skipComments: true }]}},// 忽略文件{ignores: ["node_modules/*", "dist/*", "public/*"]}
]

六、git提交規范化類型

規范提交文檔

1.package.json添加命令和初始化husky

package.json至少要有這些配置

  "scripts": {"prettier": "npx prettier . --write","prepare": "husky install","commitlint": "commitlint --edit"},"husky": {"hooks": {"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"}},"lint-staged": {"*.{js,jsx,ts,tsx}": ["prettier --write"],"*.vue": ["prettier --write"]}

執行npm run prepare,初始化husky的文件
在這里插入圖片描述

2.安裝

npm i @commitlint/cli @commitlint/config-conventional -D

3.配置git提交類型

根目錄配置:commitlint.config.js

const config = {ignores: [commit => commit.includes("init")],rules: {"header-max-length": [2, "always", 100],"scope-case": [2, "always", "lowerCase"],"subject-empty": [2, "never"],"subject-case": [2, "always", ["lower-case", "sentence-case", "start-case", "pascal-case", "upper-case"]],"subject-full-stop": [2, "never", "."],"type-empty": [2, "never"],"type-case": [2, "always", "lowerCase"],"type-enum": [2, "always", ["feat", "fix", "style", "perf", "docs", "refactor", "test"]]}
}export default config

4.添加commit-msg

在.husky/下新增commit-msg
在這里插入圖片描述

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
commit_msg=$(cat "$1")
new_commit_msg=$(echo "$commit_msg" | sed 's/^:[^:]*: //')
echo "$new_commit_msg" > "$1"
pnpm commitlint ${1}

5.測試git提交規范

在這里插入圖片描述

七、git提交觸發eslint

注意:只是針對當前新增的緩存區文件,觸發eslint;歷史提交成功的文件,eslint就不校驗了。可以通過npm run eslint去單獨觸發,單獨依次修改掉

1.package.json修改

在上述所有步驟的基礎上加上"eslint --fix",

  "lint-staged": {"*.{js,jsx,ts,tsx}": ["eslint --fix","prettier --write"],"*.vue": ["eslint --fix","prettier --write"]}

2.測試git提交觸發eslint

在這里插入圖片描述

八、最終結構

在這里插入圖片描述
package.json配置

{"name": "jg-risk-detection-web","private": true,"version": "develop_eslint","type": "module","scripts": {"dev": "pnpm setName && vite --mode beta --host","setName": "node auto-set-component-name.mjs","develop": "vite build --mode develop","test": "vite build --mode test","online": "vite build --mode online","build": "vite build","build:electron": "vite build --mode electron","build:prod": "pnpm test && pnpm build:electron","preview": "vite preview","prettier": "npx prettier . --write","prepare": "husky install","lint": "npx eslint .","commitlint": "commitlint --edit"},"dependencies": {"@antv/g6": "^4.8.24","@element-plus/icons-vue": "^2.3.1","@jg/jg-ui": "^0.0.1","@vueuse/core": "^10.11.1","@web/jg-plugin": "^0.0.34","@xterm/addon-fit": "^0.10.0","@xterm/xterm": "^5.5.0","axios": "^1.6.8","dayjs": "^1.11.10","echarts": "^5.4.3","element-plus": "2.8.4","element-resize-detector": "^1.2.4","fast-glob": "^3.3.2","highlight.js": "^11.10.0","lodash": "^4.17.21","pinia": "^2.1.7","pinia-plugin-persist": "1.0.0","pinia-plugin-persistedstate": "^3.2.1","sortablejs": "^1.15.6","vite-plugin-svg-icons": "^2.0.1","vue": "^3.4.21","vue-diff": "^1.2.4","vue-draggable-plus": "^0.6.0","vue-router": "4","vxe-pc-ui": "4.3.82","vxe-table": "4.9.29"},"devDependencies": {"@commitlint/cli": "^19.8.0","@commitlint/config-conventional": "^19.8.0","@eslint/js": "9.8.0","@typescript-eslint/eslint-plugin": "^8.31.0","@typescript-eslint/parser": "^8.31.0","@vitejs/plugin-vue": "^5.0.4","@vitejs/plugin-vue-jsx": "^4.0.1","eslint": "^9.8.0","eslint-plugin-vue": "^9.27.0","globals": "15.8.0","gm-crypt": "^0.0.2","gm-crypto": "^0.1.12","husky": "^9.1.4","lint-staged": "^15.2.9","prettier": "3.2.5","sass": "1.65.1","unplugin-auto-import": "^0.17.5","unplugin-vue-components": "^0.26.0","unplugin-vue-define-options": "^1.4.2","vite": "^5.2.0","vite-plugin-lazy-import": "^1.0.7","vue-eslint-parser": "^10.1.3"},"husky": {"hooks": {"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"}},"lint-staged": {"*.{js,jsx,ts,tsx}": ["eslint --fix","prettier --write"],"*.vue": ["eslint --fix","prettier --write"]}
}

九、eslint相關報錯

鏈接

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

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

相關文章

GCC 內建函數匯編展開詳解

1. 引言 GNU 編譯器集合&#xff08;GCC&#xff09;是廣泛使用的開源編譯器套件&#xff0c;支持多種編程語言&#xff0c;其中 C 語言編譯器是其核心組件之一。在 C 語言編譯過程中&#xff0c;GCC 不僅處理用戶編寫的標準 C 代碼&#xff0c;還提供了一類特殊的函數——內建…

uniapp利用生命周期函數實現后臺常駐示例

在 Uniapp 中&#xff0c;利用生命周期函數實現“后臺常駐”主要是通過監聽應用的前后臺狀態變化&#xff08; onHide 和 onShow &#xff09;&#xff0c;并結合 定時器、后臺任務或狀態保持邏輯 來實現。但需注意&#xff1a; 純前端 JS 代碼無法突破系統對后臺應用的限制&am…

layui時間范圍

//時間范圍String time_range para.getString("time_range", "");if (!StrUtil.isEmpty(time_range)) {String dateArr[] time_range.split("-");if (dateArr.length 2) {para.put("start_date", dateArr[0].trim().replace("…

入門版 鴻蒙 組件導航 (Navigation)

入門版 鴻蒙 組件導航 (Navigation) 注意&#xff1a;使用 DevEco Studio 運行本案例&#xff0c;要使用模擬器&#xff0c;千萬不要用預覽器&#xff0c;預覽器看看 Navigation 布局還是可以的 效果&#xff1a;點擊首頁&#xff08;Index&#xff09;跳轉到頁面&#xff08…

VUE3:封裝一個評論回復組件

之前用React封裝的評論回復組件&#xff0c;里面有三個主要部分&#xff1a;CommentComponent作為主組件&#xff0c;CommentItem處理單個評論項&#xff0c;CommentInput負責輸入框。現在需要將這些轉換為Vue3的組件。 Vue3和React在狀態管理上有所不同&#xff0c;Vue3使用r…

制作一款打飛機游戲27:精靈編輯器UI

繼續開發我們的編輯器——Sprit Edit。我們已經創建了這個小編輯器&#xff0c;它可以顯示很多精靈&#xff08;sprites&#xff09;&#xff0c;并且我們可以遍歷所有精靈。這真的很棒&#xff0c;我們可以創建新的精靈&#xff0c;這也不錯。但是&#xff0c;唉&#xff0c;我…

k8s(9) — zookeeper集群部署(親和性、污點與容忍測試)

一、部署思路 1、前期設想 zookeeper集群至少需要運行3個pod集群才能夠正常運行&#xff0c;考慮到節點會有故障的風險這個3個pod最好分別運行在&#xff13;個不同的節點上(為了實現這一需要用到親和性和反親和性概念)&#xff0c;在部署的時候對zookeeper運行的pod打標簽加…

WXT+Vue3+sass+antd+vite搭建項目開發chrome插件

WXTVue3sassantdvite搭建項目開發chrome插件 前言一、初始化項目二、項目配置調整三、options頁面配置四、集成antd五、集成sass六、環境配置七、代碼注入 vue3&#xff1a;https://cn.vuejs.org/ axios&#xff1a;https://www.axios-http.cn/docs/api_intro antd&#xff1a;…

JSAPI2.4——正則表達式

一、語法 const str 一二三四五六七八九十 //判斷內容 const reg /二/ //判斷條件 console.log(reg.test(str)); //檢查 二、test與exec方法的區別 test方法&#xff1a;用于判斷是否符合規則的字符串&#xff0c;返回值是布爾值 exec方法&…

燃氣用戶檢修工考試精選題

燃氣用戶檢修工考試精選題&#xff1a; 我國國家標準規定民用天然氣中硫化氫含量最高允許濃度是&#xff08; &#xff09;。 A. 20mg/m B. 15mg/m C. 5mg/m D. 50mg/m 答案&#xff1a;A 城市燃氣應具有可以察覺的臭味&#xff0c;當無毒燃氣泄漏到空氣中&#xff0c;達到爆炸…

【前端】1h 搞定 TypeScript 教程_只說重點

不定期更新&#xff0c;建議關注收藏點贊。 目錄 簡介使用基本類型、類型推斷和類型注解接口、類型別名、聯合類型類與繼承泛型GenericsReact 與 TS 進階高級類型裝飾器Decorators模塊系統TypeScript 編譯選項 簡介 TypeScript&#xff08;簡稱 TS&#xff09;是一種由微軟開發…

MyBatis 參數綁定

一、MyBatis 參數綁定機制 1.1 核心概念 當 Mapper 接口方法接收多個參數時&#xff0c;MyBatis 提供三種參數綁定方式&#xff1a; 默認參數名&#xff1a;arg0、arg1&#xff08;Java 8&#xff09;或 param1、param2Param 注解&#xff1a;顯式指定參數名稱POJO/DTO 對象…

【解決方案】Linux解決CUDA安裝過程中GCC版本不兼容

Linux解決CUDA安裝過程中GCC版本不兼容 目錄 問題描述 解決方法 安裝后配置 問題描述 Linux環境下安裝 CUDA 時&#xff0c;運行sudo sh cuda_10.2.89_440.33.01_linux.run命令出現 “Failed to verify gcc version.” 的報錯&#xff0c;提示 GCC 版本不兼容&#xff0c;查…

人工智能數學基礎(一):人工智能與數學

在人工智能領域&#xff0c;數學是不可或缺的基石。無論是算法的設計、模型的訓練還是結果的評估&#xff0c;都離不開數學的支持。接下來&#xff0c;我將帶大家深入了解人工智能數學基礎&#xff0c;包括微積分、線性代數、概率論、數理統計和最優化理論&#xff0c;并通過 P…

Shell腳本-嵌套循環應用案例

在Shell腳本編程中&#xff0c;嵌套循環是一種強大的工具&#xff0c;可以用于處理復雜的任務和數據結構。通過在一個循環內部再嵌套另一個循環&#xff0c;我們可以實現對多維數組、矩陣操作、文件處理等多種高級功能。本文將通過幾個實際的應用案例來展示如何使用嵌套循環解決…

勘破養生偽常識,開啟科學養生新篇

?在養生潮流風起云涌的當下&#xff0c;各種養生觀點和方法層出不窮。但其中有不少是缺乏科學依據的偽常識&#xff0c;若不加分辨地盲目跟從&#xff0c;不僅難以實現養生目的&#xff0c;還可能損害健康。因此&#xff0c;勘破這些養生偽常識&#xff0c;是邁向科學養生的關…

Nacos-3.0.0適配PostgreSQL數據庫

&#x1f9d1; 博主簡介&#xff1a;CSDN博客專家&#xff0c;歷代文學網&#xff08;PC端可以訪問&#xff1a;https://literature.sinhy.com/#/?__c1000&#xff0c;移動端可微信小程序搜索“歷代文學”&#xff09;總架構師&#xff0c;15年工作經驗&#xff0c;精通Java編…

機器學習第三篇 模型評估(交叉驗證)

Sklearn:可以做數據預處理、分類、回歸、聚類&#xff0c;不能做神經網絡。原始的工具包文檔&#xff1a;scikit-learn: machine learning in Python — scikit-learn 1.6.1 documentation數據集:使用的是MNIST手寫數字識別技術&#xff0c;大小為70000&#xff0c;數據類型為7…

如何在 IntelliJ IDEA 中編寫 Speak 程序

在當今數字化時代&#xff0c;語音交互技術越來越受到開發者的關注。如果你想在 IntelliJ IDEA&#xff08;一個強大的集成開發環境&#xff09;中編寫一個語音交互&#xff08;Speak&#xff09;程序&#xff0c;那么本文將為你提供詳細的步驟和指南。 一、環境準備 在開始編…

AI大模型學習十四、白嫖騰訊Cloud Studio AI環境 通過Ollama+Dify+DeepSeek構建生成式 AI 應用-接入DeepSeek大模型

一、說明 需要閱讀 AI大模型學習十三、白嫖騰訊Cloud Studio AI環境 通過OllamaDifyDeepSeek構建生成式 AI 應用-安裝-CSDN博客https://blog.csdn.net/jiangkp/article/details/147580344?spm1011.2415.3001.5331 我們今天干點啥呢&#xff0c;跟著官網走 模型類型 在 Dify…