模型上传
15
bun.lock
@ -6,6 +6,7 @@
|
||||
"dependencies": {
|
||||
"@zumer/snapdom": "^1.9.11",
|
||||
"openai": "^5.20.0",
|
||||
"vite-plugin-singlefile": "^2.3.0",
|
||||
"vue": "^3.5.18",
|
||||
"vue-router": "4",
|
||||
},
|
||||
@ -165,6 +166,8 @@
|
||||
|
||||
"alien-signals": ["alien-signals@2.0.7", "", {}, "sha512-wE7y3jmYeb0+h6mr5BOovuqhFv22O/MV9j5p0ndJsa7z1zJNPGQ4ph5pQk/kTTCWRC3xsA4SmtwmkzQO+7NCNg=="],
|
||||
|
||||
"braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="],
|
||||
|
||||
"csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
|
||||
|
||||
"de-indent": ["de-indent@1.0.2", "", {}, "sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg=="],
|
||||
@ -177,12 +180,18 @@
|
||||
|
||||
"fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
|
||||
|
||||
"fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="],
|
||||
|
||||
"fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"he": ["he@1.2.0", "", { "bin": { "he": "bin/he" } }, "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="],
|
||||
|
||||
"is-number": ["is-number@7.0.0", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="],
|
||||
|
||||
"magic-string": ["magic-string@0.30.19", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw=="],
|
||||
|
||||
"micromatch": ["micromatch@4.0.8", "", { "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" } }, "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA=="],
|
||||
|
||||
"muggle-string": ["muggle-string@0.4.1", "", {}, "sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ=="],
|
||||
|
||||
"nanoid": ["nanoid@3.3.11", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w=="],
|
||||
@ -203,10 +212,14 @@
|
||||
|
||||
"tinyglobby": ["tinyglobby@0.2.15", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="],
|
||||
|
||||
"to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="],
|
||||
|
||||
"typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
|
||||
|
||||
"vite": ["vite@7.1.5", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-4cKBO9wR75r0BeIWWWId9XK9Lj6La5X846Zw9dFfzMRw38IlTk2iCcUt6hsyiDRcPidc55ZParFYDXi0nXOeLQ=="],
|
||||
|
||||
"vite-plugin-singlefile": ["vite-plugin-singlefile@2.3.0", "", { "dependencies": { "micromatch": "^4.0.8" }, "peerDependencies": { "rollup": "^4.44.1", "vite": "^5.4.11 || ^6.0.0 || ^7.0.0" } }, "sha512-DAcHzYypM0CasNLSz/WG0VdKOCxGHErfrjOoyIPiNxTPTGmO6rRD/te93n1YL/s+miXq66ipF1brMBikf99c6A=="],
|
||||
|
||||
"vscode-uri": ["vscode-uri@3.1.0", "", {}, "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ=="],
|
||||
|
||||
"vue": ["vue@3.5.21", "", { "dependencies": { "@vue/compiler-dom": "3.5.21", "@vue/compiler-sfc": "3.5.21", "@vue/runtime-dom": "3.5.21", "@vue/server-renderer": "3.5.21", "@vue/shared": "3.5.21" }, "peerDependencies": { "typescript": "*" }, "optionalPeers": ["typescript"] }, "sha512-xxf9rum9KtOdwdRkiApWL+9hZEMWE90FHh8yS1+KJAiWYh+iGWV1FquPjoO9VUHQ+VIhsCXNNyZ5Sf4++RVZBA=="],
|
||||
@ -214,5 +227,7 @@
|
||||
"vue-router": ["vue-router@4.5.1", "", { "dependencies": { "@vue/devtools-api": "^6.6.4" }, "peerDependencies": { "vue": "^3.2.0" } }, "sha512-ogAF3P97NPm8fJsE4by9dwSYtDwXIY1nFY9T6DyQnGHd1E2Da94w9JIolpe42LJGIl0DwOHBi8TcRPlPGwbTtw=="],
|
||||
|
||||
"vue-tsc": ["vue-tsc@3.0.6", "", { "dependencies": { "@volar/typescript": "2.4.23", "@vue/language-core": "3.0.6" }, "peerDependencies": { "typescript": ">=5.0.0" }, "bin": { "vue-tsc": "./bin/vue-tsc.js" } }, "sha512-Tbs8Whd43R2e2nxez4WXPvvdjGbW24rOSgRhLOHXzWiT4pcP4G7KeWh0YCn18rF4bVwv7tggLLZ6MJnO6jXPBg=="],
|
||||
|
||||
"micromatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
"dependencies": {
|
||||
"@zumer/snapdom": "^1.9.11",
|
||||
"openai": "^5.20.0",
|
||||
"vite-plugin-singlefile": "^2.3.0",
|
||||
"vue": "^3.5.18",
|
||||
"vue-router": "4"
|
||||
},
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
<template>
|
||||
<div class="home-placeholder">
|
||||
<p>此页面已被“模型广场”替代。请使用顶部导航。</p>
|
||||
</div>
|
||||
</template>
|
||||
@ -35,17 +35,20 @@ onMounted(load)
|
||||
<template>
|
||||
<div class="list-page">
|
||||
<div class="toolbar">
|
||||
<input v-model="st.q" placeholder="搜索标题/描述" @keydown.enter="st.page=1; load()" />
|
||||
<select v-model="st.sort" @change="st.page=1; load()">
|
||||
<input v-model="st.q" placeholder="搜索标题/描述"
|
||||
@keydown.enter="st.page = 1; load()" />
|
||||
<select v-model="st.sort" @change="st.page = 1; load()">
|
||||
<option value="new">最新</option>
|
||||
<option value="old">最早</option>
|
||||
</select>
|
||||
<button class="btn" @click="st.page=1; load()" :disabled="st.loading">搜索</button>
|
||||
<button class="btn" @click="st.page = 1; load()"
|
||||
:disabled="st.loading">搜索</button>
|
||||
</div>
|
||||
|
||||
<div v-if="st.error" class="error">{{ st.error }}</div>
|
||||
<div v-else class="grid">
|
||||
<div v-for="m in st.items" :key="m.id" class="card" @click="goDetail(m.id)">
|
||||
<div v-for="m in st.items" :key="m.id" class="card"
|
||||
@click="goDetail(m.id)">
|
||||
<img :src="api.previewUrl(m.id)" alt="preview" />
|
||||
<div class="meta">
|
||||
<h3>{{ m.title }}</h3>
|
||||
@ -55,24 +58,89 @@ onMounted(load)
|
||||
</div>
|
||||
|
||||
<div class="pager" v-if="st.total > st.pageSize">
|
||||
<button :disabled="st.page<=1" @click="st.page--; load()">上一页</button>
|
||||
<button :disabled="st.page <= 1" @click="st.page--; load()">上一页</button>
|
||||
<span>第 {{ st.page }} 页</span>
|
||||
<button :disabled="st.page*st.pageSize>=st.total" @click="st.page++; load()">下一页</button>
|
||||
<button :disabled="st.page * st.pageSize >= st.total"
|
||||
@click="st.page++; load()">下一页</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.list-page{padding:12px;height:100%;box-sizing:border-box;overflow:auto}
|
||||
.toolbar{display:flex;gap:8px;margin-bottom:12px}
|
||||
input,select{padding:6px 8px;border:1px solid #e5e7eb;border-radius:8px}
|
||||
.btn{padding:6px 10px;border:1px solid #e5e7eb;border-radius:8px;background:#fff}
|
||||
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}
|
||||
.card{border:1px solid #e5e7eb;border-radius:10px;overflow:hidden;cursor:pointer;background:#fff;display:flex;flex-direction:column}
|
||||
.card img{width:100%;height:140px;object-fit:cover;background:#f3f4f6}
|
||||
.meta{padding:10px}
|
||||
.meta h3{margin:0 0 6px 0;font-size:14px}
|
||||
.meta p{margin:0;color:#6b7280;font-size:12px}
|
||||
.pager{display:flex;gap:10px;align-items:center;justify-content:center;margin-top:12px}
|
||||
.error{color:#b91c1c}
|
||||
.list-page {
|
||||
padding: 12px;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
overflow: auto
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px
|
||||
}
|
||||
|
||||
input,
|
||||
select {
|
||||
padding: 6px 8px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
background: #fff
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
||||
gap: 12px
|
||||
}
|
||||
|
||||
.card {
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
flex-direction: column
|
||||
}
|
||||
|
||||
.card img {
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
object-fit: contain;
|
||||
background: white
|
||||
}
|
||||
|
||||
.meta {
|
||||
padding: 10px
|
||||
}
|
||||
|
||||
.meta h3 {
|
||||
margin: 0 0 6px 0;
|
||||
font-size: 14px
|
||||
}
|
||||
|
||||
.meta p {
|
||||
margin: 0;
|
||||
color: #6b7280;
|
||||
font-size: 12px
|
||||
}
|
||||
|
||||
.pager {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 12px
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #b91c1c
|
||||
}
|
||||
</style>
|
||||
@ -972,6 +972,10 @@ function loadFromJSONText(text: string) {
|
||||
wireSeq = Math.max(wireSeq, maxWireId)
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
window.loadCircuitFromJSONText = loadFromJSONText
|
||||
|
||||
|
||||
function onImportFileChange(e: Event) {
|
||||
const input = e.target as HTMLInputElement
|
||||
const file = input.files && input.files[0]
|
||||
|
||||
|
Before Width: | Height: | Size: 234 KiB |
BIN
src/views/circuit-ele/battery.webp
Normal file
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 154 KiB |
BIN
src/views/circuit-ele/capacitor.webp
Normal file
|
After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 120 KiB |
BIN
src/views/circuit-ele/inductor.webp
Normal file
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 245 KiB |
BIN
src/views/circuit-ele/light_bulb.webp
Normal file
|
After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 832 KiB |
BIN
src/views/circuit-ele/light_bulb_grow.webp
Normal file
|
After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 252 KiB |
BIN
src/views/circuit-ele/meter.webp
Normal file
|
After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 405 KiB |
BIN
src/views/circuit-ele/power_supply.webp
Normal file
|
After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 597 KiB |
BIN
src/views/circuit-ele/resistance_box.webp
Normal file
|
After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 318 KiB |
BIN
src/views/circuit-ele/resistor.webp
Normal file
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 254 KiB |
BIN
src/views/circuit-ele/sliding_rheostat.webp
Normal file
|
After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 37 KiB |
BIN
src/views/circuit-ele/sliding_rheostat_pin.webp
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 395 KiB |
BIN
src/views/circuit-ele/switch_off.webp
Normal file
|
After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 402 KiB |
BIN
src/views/circuit-ele/switch_on.webp
Normal file
|
After Width: | Height: | Size: 31 KiB |
37
src/views/circuit-ele/webp.py
Normal file
@ -0,0 +1,37 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
def convert_png_to_webp():
|
||||
png_files = []
|
||||
|
||||
# 递归遍历当前目录及所有子目录
|
||||
for root, dirs, files in os.walk('.'):
|
||||
for file in files:
|
||||
if file.lower().endswith('.png'):
|
||||
png_files.append(os.path.join(root, file))
|
||||
|
||||
if not png_files:
|
||||
print("当前目录及子目录下没有找到PNG文件。")
|
||||
return
|
||||
|
||||
print(f"找到 {len(png_files)} 个PNG文件,开始转换...")
|
||||
|
||||
# 遍历并转换每个PNG文件
|
||||
for png_file in png_files:
|
||||
# 构建输出文件名(替换扩展名为.webp)
|
||||
webp_file = os.path.splitext(png_file)[0] + '.webp'
|
||||
|
||||
# 构建ffmpeg命令,设置压缩质量为80%(可以根据需要调整)
|
||||
cmd = ['ffmpeg', '-i', png_file, '-c:v', 'libwebp', '-quality', '80', webp_file]
|
||||
|
||||
try:
|
||||
print(f"正在转换: {png_file} -> {webp_file}")
|
||||
subprocess.run(cmd, check=True)
|
||||
print(f"成功转换: {webp_file}")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"转换失败: {png_file}, 错误: {e}")
|
||||
|
||||
print("转换完成!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
convert_png_to_webp()
|
||||
@ -1,18 +1,18 @@
|
||||
// 显式导入所有电路元件图片,并定义其基本属性
|
||||
|
||||
import battery from './circuit-ele/battery.png'
|
||||
import powerSupply from './circuit-ele/power_supply.png'
|
||||
import capacitor from './circuit-ele/capacitor.png'
|
||||
import inductor from './circuit-ele/inductor.png'
|
||||
import lightBulb from './circuit-ele/light_bulb.png'
|
||||
import lightBulbGrow from './circuit-ele/light_bulb_grow.png'
|
||||
import resistor from './circuit-ele/resistor.png'
|
||||
import resistanceBox from './circuit-ele/resistance_box.png'
|
||||
import switchOff from './circuit-ele/switch_off.png'
|
||||
import switchOn from './circuit-ele/switch_on.png'
|
||||
import meter from './circuit-ele/meter.png'
|
||||
import slidingRheostat from './circuit-ele/sliding_rheostat.png'
|
||||
import slidingRheostatPin from './circuit-ele/sliding_rheostat_pin.png'
|
||||
import battery from './circuit-ele/battery.webp'
|
||||
import powerSupply from './circuit-ele/power_supply.webp'
|
||||
import capacitor from './circuit-ele/capacitor.webp'
|
||||
import inductor from './circuit-ele/inductor.webp'
|
||||
import lightBulb from './circuit-ele/light_bulb.webp'
|
||||
import lightBulbGrow from './circuit-ele/light_bulb_grow.webp'
|
||||
import resistor from './circuit-ele/resistor.webp'
|
||||
import resistanceBox from './circuit-ele/resistance_box.webp'
|
||||
import switchOff from './circuit-ele/switch_off.webp'
|
||||
import switchOn from './circuit-ele/switch_on.webp'
|
||||
import meter from './circuit-ele/meter.webp'
|
||||
import slidingRheostat from './circuit-ele/sliding_rheostat.webp'
|
||||
import slidingRheostatPin from './circuit-ele/sliding_rheostat_pin.webp'
|
||||
import textBox from './circuit-ele/text_box.svg'
|
||||
|
||||
export type ConnectionPoint = {
|
||||
|
||||
@ -15,8 +15,6 @@
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { viteSingleFile } from 'vite-plugin-singlefile'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
plugins: [vue(), /* viteSingleFile() */],
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
proxy: {
|
||||
|
||||