vue2server7 7.0.75 → 7.0.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/test/1 +90 -0
- package/MybatisX-1.6.3.zip +0 -0
- package/file.007 +0 -0
- package/test/2.txt +0 -19
- package/test//346/265/213/350/257/225/347/224/250/344/276/213.xlsx +0 -0
package/package.json
CHANGED
package/test/1
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const app = express();
|
|
5
|
+
const port = process.env.PORT || 3000;
|
|
6
|
+
|
|
7
|
+
// 配置静态文件目录
|
|
8
|
+
app.use(express.static(path.join(__dirname, 'public'))); // 前端页面
|
|
9
|
+
app.use('/files', express.static(path.join(__dirname, 'files'))); // 文件下载目录
|
|
10
|
+
|
|
11
|
+
// 获取文件列表的API
|
|
12
|
+
app.get('/api/files', (req, res) => {
|
|
13
|
+
const filesDir = path.join(__dirname, 'files');
|
|
14
|
+
|
|
15
|
+
fs.readdir(filesDir, (err, files) => {
|
|
16
|
+
if (err) {
|
|
17
|
+
return res.status(500).json({ error: '无法读取文件目录' });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 过滤掉隐藏文件,只返回文件信息
|
|
21
|
+
const fileList = files
|
|
22
|
+
.filter(file => !file.startsWith('.'))
|
|
23
|
+
.map(file => {
|
|
24
|
+
const filePath = path.join(filesDir, file);
|
|
25
|
+
const stats = fs.statSync(filePath);
|
|
26
|
+
return {
|
|
27
|
+
name: file,
|
|
28
|
+
size: stats.size,
|
|
29
|
+
type: path.extname(file).substring(1),
|
|
30
|
+
url: `/files/${file}`,
|
|
31
|
+
downloadUrl: `/download/${encodeURIComponent(file)}`
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
res.json(fileList);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// 下载文件的路由
|
|
40
|
+
app.get('/download/:filename', (req, res) => {
|
|
41
|
+
const filename = req.params.filename;
|
|
42
|
+
const filePath = path.join(__dirname, 'files', filename);
|
|
43
|
+
|
|
44
|
+
// 检查文件是否存在
|
|
45
|
+
if (!fs.existsSync(filePath)) {
|
|
46
|
+
return res.status(404).send('文件不存在');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// 设置响应头,强制下载
|
|
50
|
+
res.download(filePath, (err) => {
|
|
51
|
+
if (err) {
|
|
52
|
+
console.error('下载失败:', err);
|
|
53
|
+
res.status(500).send('下载失败');
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// 预览文件的路由(可选)
|
|
59
|
+
app.get('/preview/:filename', (req, res) => {
|
|
60
|
+
const filename = req.params.filename;
|
|
61
|
+
const filePath = path.join(__dirname, 'files', filename);
|
|
62
|
+
|
|
63
|
+
if (!fs.existsSync(filePath)) {
|
|
64
|
+
return res.status(404).send('文件不存在');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 对于图片和PDF等可以预览的文件类型
|
|
68
|
+
res.sendFile(filePath);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// 默认首页
|
|
72
|
+
app.get('/', (req, res) => {
|
|
73
|
+
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// 404 处理
|
|
77
|
+
app.use((req, res) => {
|
|
78
|
+
res.status(404).send('404 - 页面未找到');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// 错误处理
|
|
82
|
+
app.use((err, req, res, next) => {
|
|
83
|
+
console.error(err.stack);
|
|
84
|
+
res.status(500).send('服务器内部错误');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
app.listen(port, () => {
|
|
88
|
+
console.log(`🚀 文件服务器运行在 http://localhost:${port}`);
|
|
89
|
+
console.log(`📁 文件目录: ${path.join(__dirname, 'files')}`);
|
|
90
|
+
});
|
package/MybatisX-1.6.3.zip
DELETED
|
Binary file
|
package/file.007
DELETED
|
Binary file
|
package/test/2.txt
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
models:
|
|
2
|
-
- name: 'qwen15-32b' # 模型名称,对应你截图 Body 里的 model
|
|
3
|
-
provider: 'openai' # 使用 openai 兼容模式
|
|
4
|
-
model: 'qwen15-32b' # 实际调用的模型ID
|
|
5
|
-
apiBase: 'http://maasapp.aip.bj.bob.test:8080/apis/ais-v2' # 对应截图 URL,注意去掉了末尾的 /chat/completions
|
|
6
|
-
apiKey: 'YOUR_CUSTOM_SERVICE_API_KEY' # 对应截图中的 API key
|
|
7
|
-
requestOptions:
|
|
8
|
-
headers:
|
|
9
|
-
# 对应截图 Headers 中的 Authorization
|
|
10
|
-
Authorization: 'Bearer YOUR_CUSTOM_SERVICE_API_KEY'
|
|
11
|
-
# 对应截图 Headers 中的 X-LLM-Application-Tag
|
|
12
|
-
X-LLM-Application-Tag: 'proxyai'
|
|
13
|
-
# 对应截图 Headers 中的 Content-Type
|
|
14
|
-
Content-Type: 'application/json'
|
|
15
|
-
# 对应截图 Body 中的其他参数
|
|
16
|
-
body:
|
|
17
|
-
stream: true
|
|
18
|
-
temperature: 0.1
|
|
19
|
-
max_tokens: 20000
|
|
Binary file
|