chore: 项目文件归类整理

- assets/icons/ → 图标资源 (llama.ico, llama.png)
- css/ → 样式文件 (style.css)
- js/ → 所有业务代码
- js/lib/ → 第三方库 (marked.esm.js)
- js/components/ → UI 组件

修正所有 import 路径、HTML 引用、SW 缓存列表
This commit is contained in:
thzxx
2026-04-03 11:40:01 +08:00
parent 38edaee0f0
commit 41b512c779
13 changed files with 44 additions and 19 deletions
+33 -8
View File
@@ -52,14 +52,39 @@ OLLAMA_ORIGINS="*" ollama serve
``` ```
metona-ollama/ metona-ollama/
├── index.html # 主页面 + 应用逻辑 ├── index.html # 入口页面(纯模板)
├── style.css # 暗色主题样式 ├── manifest.json # PWA 清单
├── ollama-api.js # Ollama REST API 封装 ├── sw.js # Service Worker (PWA)
├── chat-db.js # IndexedDB 持久化层 ├── LICENSE
├── marked.esm.js # Markdown 渲染器 ├── README.md
├── sw.js # Service Worker (PWA)
├── manifest.json # PWA 清单 ├── assets/
└── README.md │ └── icons/ # 图标资源
│ ├── llama.ico
│ └── llama.png
├── css/
│ └── style.css # 暗色主题样式
└── js/
├── app.js # 主入口 / 初始化协调
├── ollama-api.js # Ollama REST API 封装
├── chat-db.js # IndexedDB 持久化层
├── state.js # 响应式状态管理
├── utils.js # 通用工具函数
├── sanitizer.js # HTML XSS 净化器
├── marked-config.js # Markdown 渲染器配置
├── lib/
│ └── marked.esm.js # Markdown 渲染器(第三方)
└── components/
├── chat-area.js # 消息渲染 / 流式更新 / 导出
├── input-area.js # 文本输入 / 图片上传 / 发送
├── history-modal.js # 历史记录面板 / 搜索 / 分页
├── settings-modal.js # 设置面板 / 数据管理
├── header.js # 顶部导航 / 连接状态
├── model-bar.js # 模型选择栏
├── toast.js # Toast 通知
└── lightbox.js # 图片预览
``` ```
## ⚙️ 设置项 ## ⚙️ 设置项

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 361 KiB

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File
+2 -2
View File
@@ -8,9 +8,9 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="description" content="Metona Ollama Client - 流式聊天、多模态、历史管理"> <meta name="description" content="Metona Ollama Client - 流式聊天、多模态、历史管理">
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
<link rel="icon" href="llama.ico" type="image/x-icon"> <link rel="icon" href="assets/icons/llama.ico" type="image/x-icon">
<title>Metona Ollama</title> <title>Metona Ollama</title>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="css/style.css">
</head> </head>
<body> <body>
<div id="app"> <div id="app">
+2 -2
View File
@@ -3,8 +3,8 @@
* 负责初始化所有组件、协调事件流、管理生命周期 * 负责初始化所有组件、协调事件流、管理生命周期
*/ */
import { ChatDB } from '../chat-db.js'; import { ChatDB } from './chat-db.js';
import { OllamaAPI } from '../ollama-api.js'; import { OllamaAPI } from './ollama-api.js';
import { state, KEYS } from './state.js'; import { state, KEYS } from './state.js';
import { generateId } from './utils.js'; import { generateId } from './utils.js';
View File
+1 -1
View File
@@ -5,7 +5,7 @@
import { state, KEYS } from '../state.js'; import { state, KEYS } from '../state.js';
import { formatSize } from '../utils.js'; import { formatSize } from '../utils.js';
import { OllamaAPI } from '../../ollama-api.js'; import { OllamaAPI } from '../ollama-api.js';
let connStatusEl; let connStatusEl;
+1 -1
View File
@@ -7,7 +7,7 @@ import { debounce, formatSize } from '../utils.js';
import { updateConnectionInfo, updateRunningModels } from './header.js'; import { updateConnectionInfo, updateRunningModels } from './header.js';
import { loadModels } from './model-bar.js'; import { loadModels } from './model-bar.js';
import { showToast } from './toast.js'; import { showToast } from './toast.js';
import { OllamaAPI } from '../../ollama-api.js'; import { OllamaAPI } from '../ollama-api.js';
let settingsModalEl; let settingsModalEl;
+1 -1
View File
@@ -3,7 +3,7 @@
* 封装 marked.js,配置自定义渲染器和安全策略 * 封装 marked.js,配置自定义渲染器和安全策略
*/ */
import { marked } from '../marked.esm.js'; import { marked } from './lib/marked.esm.js';
import { SAFE_URI_SCHEMES } from './sanitizer.js'; import { SAFE_URI_SCHEMES } from './sanitizer.js';
// 配置 marked // 配置 marked
View File
+4 -4
View File
@@ -7,10 +7,10 @@ const CACHE_NAME = 'metona-ollama-v3';
const ASSETS = [ const ASSETS = [
'./', './',
'./index.html', './index.html',
'./style.css', './css/style.css',
'./chat-db.js', './js/chat-db.js',
'./marked.esm.js', './js/lib/marked.esm.js',
'./ollama-api.js', './js/ollama-api.js',
'./manifest.json' './manifest.json'
]; ];