079project 1.0.0

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.
Files changed (67) hide show
  1. package/GroupStarter.cjs +647 -0
  2. package/LICENSE +165 -0
  3. package/PropagateSignalUseJsWorker.js +92 -0
  4. package/README.md +102 -0
  5. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/README.md +52 -0
  6. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/README.zh_CN.md +59 -0
  7. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/RedisService.exe +0 -0
  8. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cygcrypto-3.dll +0 -0
  9. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cyggcc_s-seh-1.dll +0 -0
  10. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cygssl-3.dll +0 -0
  11. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cygstdc++-6.dll +0 -0
  12. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cygwin1.dll +0 -0
  13. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cygz.dll +0 -0
  14. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/dump.rdb +0 -0
  15. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/install_redis_service.bat +100 -0
  16. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-benchmark.exe +0 -0
  17. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-check-aof.exe +0 -0
  18. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-check-rdb.exe +0 -0
  19. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-cli.exe +0 -0
  20. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-full.conf +376 -0
  21. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-sentinel.exe +0 -0
  22. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-server.exe +0 -0
  23. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis.conf +2348 -0
  24. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/sentinel.conf +361 -0
  25. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/start.bat +4 -0
  26. package/Redis-8.0.3-Windows-x64-cygwin-with-Service/uninstall_redis_service.bat +30 -0
  27. package/boot.py +51 -0
  28. package/chat_Client.js +29 -0
  29. package/controller.cjs +118 -0
  30. package/enhancedForwarder.js +378 -0
  31. package/forwarder.js +1456 -0
  32. package/groupmanager.cjs +143 -0
  33. package/howToStart.txt +8 -0
  34. package/lemma.csv +210 -0
  35. package/load.py +35 -0
  36. package/mainManager.cjs +81 -0
  37. package/mainStarter.cjs +535 -0
  38. package/main_Serve.cjs +2745 -0
  39. package/main_Study.cjs +3230 -0
  40. package/memeMergeWorker.cjs +55 -0
  41. package/model_RNN.py +117 -0
  42. package/note.txt +5 -0
  43. package/notebook.txt +8 -0
  44. package/npminstall-debug.log +206 -0
  45. package/package.json +48 -0
  46. package/public/chat_straight.html +90 -0
  47. package/public/index.html +247 -0
  48. package/public/indexmain.html +136 -0
  49. package/public/monitor.html +194 -0
  50. package/robots/wikitext-something.txt +25 -0
  51. package/runtime.proto +24 -0
  52. package/runtime_data.json +766294 -0
  53. package/serializer_seq2seq.h5 +0 -0
  54. package/start.js +46 -0
  55. package/tests/test_FIrststep1.txt +1224 -0
  56. package/tests/test_FIrststep2.txt +2956 -0
  57. package/tests/test_FIrststep3.txt +1224 -0
  58. package/tests/test_FIrststep4.txt +1396 -0
  59. package/tests/test_FIrststep5.txt +2852 -0
  60. package/tests/test_FIrststep6.txt +1516 -0
  61. package/tests/test_FirstStep7.txt +1748 -0
  62. package/tests/test_Firstsetp8.txt +2672 -0
  63. package/tokenizer.json +1 -0
  64. package/vocabularySplitter.js +253 -0
  65. package/wikitext/.gitattributes +27 -0
  66. package/wikitext/README.md +344 -0
  67. package/wikitext/describtion.txt +1 -0
package/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,92 @@
1
+ const workerpool = require('workerpool');
2
+
3
+ // 并行信号扩散计算
4
+ function propagateSignalBatch({ points, startIDs, strengths, options = {} }) {
5
+ const {
6
+ decayK = 1,
7
+ maxStep = 10,
8
+ minSignal = 0.01,
9
+ directionalMultiplier = 0.7,
10
+ bidirectionalMultiplier = 1.2
11
+ } = options;
12
+
13
+ // 信号传播结果
14
+ const signalMap = new Map();
15
+
16
+ // 找出节点连接
17
+ function getConnections(pointID) {
18
+ const point = points.find(p => p.pointID === pointID);
19
+ return point ? point.connect : [];
20
+ }
21
+
22
+ // 初始活跃节点
23
+ let active = startIDs.map((id, i) => ({
24
+ id,
25
+ value: strengths[i],
26
+ from: null,
27
+ connectionType: -1
28
+ }));
29
+
30
+ // 进行扩散
31
+ let step = 0;
32
+ while (active.length > 0 && step < maxStep) {
33
+ // 每一步重置访问集合,允许信号叠加
34
+ const visited = new Set();
35
+ const next = [];
36
+
37
+ for (const { id, value, from, connectionType } of active) {
38
+ if (value < minSignal) continue;
39
+
40
+ // 累加信号强度
41
+ signalMap.set(id, (signalMap.get(id) || 0) + value);
42
+
43
+ if (visited.has(id)) continue;
44
+ visited.add(id);
45
+
46
+ // 获取连接
47
+ const connections = getConnections(id);
48
+
49
+ for (const [weight, neighborID, direction = 0] of connections) {
50
+ // 根据连接类型决定衰减系数
51
+ let effectiveDecay = decayK;
52
+
53
+ if (direction === 0) {
54
+ // 双向连接衰减较大
55
+ effectiveDecay *= bidirectionalMultiplier;
56
+ } else {
57
+ // 单向连接衰减较小
58
+ effectiveDecay *= directionalMultiplier;
59
+ }
60
+
61
+ // 计算传播后的信号强度
62
+ const nextValue = value - effectiveDecay * weight;
63
+
64
+ // 信号足够强才继续传播
65
+ if (nextValue >= minSignal) {
66
+ next.push({
67
+ id: neighborID,
68
+ value: nextValue,
69
+ from: id,
70
+ connectionType: direction
71
+ });
72
+ }
73
+ }
74
+ }
75
+
76
+ active = next;
77
+ step++;
78
+ }
79
+
80
+ // 将Map转为普通对象以便传递
81
+ const result = {};
82
+ for (const [key, value] of signalMap.entries()) {
83
+ result[key] = value;
84
+ }
85
+
86
+ return { signalValues: result, steps: step };
87
+ }
88
+
89
+ // 导出工作函数
90
+ workerpool.worker({
91
+ propagateSignalBatch
92
+ });
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # Phoenix AI 多模态工作组
2
+
3
+ ## 项目简介
4
+ Phoenix AI 是一个基于多模态架构的人工智能系统,支持文本、图片、语音三种数据类型的处理。系统通过分布式工作组架构实现高效的任务分片和并行处理,适用于大规模数据集和复杂任务场景。
5
+
6
+ ---
7
+
8
+ ## 文件结构
9
+ .
10
+ ├── .gitignore
11
+ ├── LICENSE
12
+ ├── package.json
13
+ ├── test_*.txt
14
+ ├── wikitext-103-all.txt
15
+ ├── v0.1/
16
+ │ ├── boot.py
17
+ │ ├── chat_Client.js
18
+ │ ├── controller.cjs
19
+ │ ├── enhancedForwarder.js
20
+ │ ├── forwarder.js
21
+ │ ├── groupmanager.cjs
22
+ │ ├── GroupStarter.cjs
23
+ │ ├── howToStart.txt
24
+ │ ├── lemma.csv
25
+ │ ├── load.py
26
+ │ ├── main_Serve.cjs
27
+ │ ├── main_Study.cjs
28
+ │ ├── mainManager.cjs
29
+ │ ├── mainStarter.cjs
30
+ │ ├── memeMergeWorker.cjs
31
+ │ ├── model_RNN.py
32
+ │ ├── note.txt
33
+ │ ├── notebook.txt
34
+ │ └── high-v3.0/
35
+ │ ├── api.js
36
+ │ └── ...
37
+
38
+ ---
39
+
40
+ ## 快速开始
41
+
42
+ ### 1. 环境准备
43
+ - 安装 Node.js (>=16.x)
44
+ - 安装 Python (>=3.8)
45
+ - 安装依赖:
46
+ npm install
47
+
48
+ ### 2. 启动步骤
49
+ 0. **加载语料库**
50
+ 使用的语料库为wikitext,由于大小问题,无法放入package中
51
+ 在初始化之前,需要将wikitext-103-all.txt放入/wikitext/中,当然也可以选择不使用这个语料库,但仍然需要保留wikitext文件夹并将总语料库的.txt文本,将文件名改为wikitext-103-all.txt后放入/wikitext/中
52
+
53
+ 1. **分割词表**
54
+ 使用 `mainManager.cjs` 将大词表分割为小分片:
55
+ node groupManager.cjs --shard-size-kb=100
56
+
57
+ 2. **启动工作组**
58
+ 使用 `mainStarter.cjs` 启动文本、图片、语音三大工作组:
59
+ node mainStarter.cjs
60
+
61
+
62
+
63
+ 3. **访问服务**
64
+ - 文本组入口: http://localhost:9100
65
+ - 图片组入口: http://localhost:9200
66
+ - 语音组入口: http://localhost:9300
67
+ - 多模态管理器: http://localhost:9050
68
+ *** 注意,目前python的部分-前端序列化部分尚未完成,所以python可能没有用处 ***
69
+ ---
70
+
71
+ ## 功能说明
72
+
73
+ ### 文本处理
74
+ - 支持大规模文本数据的分片处理
75
+ - 提供 NLP 功能,如文本生成、摘要、情感分析等
76
+
77
+ ### 图片处理
78
+ - 支持图片描述生成
79
+ - 提供文生图功能
80
+
81
+ ### 语音处理
82
+ - 支持语音转写(ASR)
83
+ - 提供文本转语音(TTS)功能
84
+
85
+ ---
86
+
87
+ ## 贡献指南
88
+ 欢迎对本项目提出建议或贡献代码,请参考以下步骤:
89
+ 1. Fork 本仓库
90
+ 2. 创建新分支
91
+ 3. 提交代码并发起 Pull Request
92
+
93
+ ---
94
+
95
+ ## 联系方式
96
+ - 项目维护者: Phoenix AI 团队
97
+ - 邮箱: 3873636760@qq.com
98
+
99
+ ---
100
+
101
+ ## 许可证
102
+ 本项目遵循 LGPL-3.0 许可证,详情请参阅 LICENSE 文件。
@@ -0,0 +1,52 @@
1
+ ### [English](https://github.com/redis-windows/redis-windows/blob/main/README.md) | [简体中文](https://github.com/redis-windows/redis-windows/blob/main/README.zh_CN.md)
2
+
3
+ # Redis Windows Version
4
+ ### With the powerful automated building capability of GitHub Actions, we can compile the latest version of Redis for Windows system in real-time.
5
+ The entire compilation process is completely transparent and open, with the compilation script located in the [.github/workflows/](https://github.com/redis-windows/redis-windows/tree/main/.github/workflows) directory and the compilation logs available on the [Actions](https://github.com/redis-windows/redis-windows/actions) page. In addition, we have added a hash calculation step when the compilation is completed, and the result is printed in the log. This is unmodifiable and recorded in the release page. You can verify the hash value of the downloaded file against the log and release page.
6
+ Our project is absolutely pure and without any hidden features, and can withstand the scrutiny of all experts. If you have any good ideas, please feel free to communicate with us.
7
+
8
+ ## We provide three operation modes:
9
+ 1. Run the start.bat script in the project to start directly with one click.
10
+ 2. Use the command line.
11
+ 3. Support running as a system service.
12
+
13
+ ### Command line startup:
14
+ cmd startup:
15
+ ```shell
16
+ redis-server.exe redis.conf
17
+ ```
18
+ powershell startup:
19
+ ```shell
20
+ ./redis-server.exe redis.conf
21
+ ```
22
+
23
+ ### Service installation:
24
+ Can achieve automatic startup on boot. Please run it as an administrator and change RedisService.exe to the actual directory where it is stored.
25
+ ```shell
26
+ sc.exe create Redis binpath=C:\Software\Redis\RedisService.exe start= auto
27
+ ```
28
+ Start service
29
+ ```shell
30
+ net start Redis
31
+ ```
32
+ Out of Service
33
+ ```shell
34
+ net stop Redis
35
+ ```
36
+ Uninstall service
37
+ ```shell
38
+ sc.exe delete Redis
39
+ ```
40
+
41
+ ![image](https://user-images.githubusercontent.com/515784/215540157-65f55297-cde2-49b3-8ab3-14dca7e11ee0.png)
42
+
43
+
44
+ Project Home: https://github.com/redis-windows/redis-windows
45
+
46
+ ## Acknowledgement:
47
+ [![NetEngine](https://avatars.githubusercontent.com/u/36178221?s=180&v=4)](https://www.zhihu.com/question/424272611/answer/2611312760)
48
+ [![JetBrains Logo (Main) logo](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=redis-windows)
49
+
50
+
51
+ ## Disclaimer
52
+ We suggest that you use it for local development and follow Redis official guidance to deploy it on Linux for production environment. This project doesn't bear any responsibility for any losses caused by using it and is only for learning and exchange purposes.
@@ -0,0 +1,59 @@
1
+ ### [English](https://github.com/redis-windows/redis-windows/blob/main/README.md) | [简体中文](https://github.com/redis-windows/redis-windows/blob/main/README.zh_CN.md)
2
+
3
+ # Redis Windows版本
4
+
5
+ ### 借助GitHub Actions强大的自动化构建能力,为我们实时编译适用于Windows系统的Redis最新版本
6
+
7
+ 整个编译过程完全公开透明, 编译脚本在[.github/workflows/](https://github.com/redis-windows/redis-windows/tree/main/.github/workflows) 目录中,编译日志可在 [Actions](https://github.com/redis-windows/redis-windows/actions)页面查看。此外,我们在编译结束,新增了哈希值计算环节,计算结果打印在日志中,这是任何人不可修改的,并写入发布页面。您可以核对下载到本地的文件的哈希值,是否与日志和发布页面的一致。本项目绝对纯洁无私货,经得起各位大佬审查。如您有好的想法,也欢迎交流。
8
+
9
+
10
+ ### 提供三种运行模式
11
+
12
+ 直接运行项目中的 start.bat 脚本,一键启动
13
+
14
+ 或者使用命令行
15
+
16
+ 还支持以系统服务运行
17
+
18
+
19
+ ## 命令行启动
20
+ cmd 启动
21
+ ```shell
22
+ redis-server.exe redis.conf
23
+ ```
24
+ powershell 启动
25
+ ```shell
26
+ ./redis-server.exe redis.conf
27
+ ```
28
+
29
+ ## 安装服务
30
+ 可实现开机自启动
31
+ 请以管理员身份运行,并将RedisService.exe改为您实际存放的路径
32
+
33
+ ```shell
34
+ sc.exe create Redis binpath=C:\Software\Redis\RedisService.exe start= auto
35
+ ```
36
+ 启动服务
37
+ ```shell
38
+ net start Redis
39
+ ```
40
+ 停止服务
41
+ ```shell
42
+ net stop Redis
43
+ ```
44
+ 卸载服务
45
+ ```shell
46
+ sc.exe delete Redis
47
+ ```
48
+
49
+ ![image](https://user-images.githubusercontent.com/515784/215540157-65f55297-cde2-49b3-8ab3-14dca7e11ee0.png)
50
+
51
+
52
+ 项目主页: https://github.com/redis-windows/redis-windows
53
+
54
+ ### 鸣谢
55
+ [![NetEngine](https://avatars.githubusercontent.com/u/36178221?s=180&v=4)](https://www.zhihu.com/question/424272611/answer/2611312760)
56
+ [![JetBrains Logo (Main) logo](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=redis-windows)
57
+
58
+ ### 免责声明
59
+ 建议您在本地开发环节使用,生产环境请按照Redis官方指导,在Linux中部署。本项目不承担由此给您带来的任何损失,仅供学习交流。
@@ -0,0 +1,100 @@
1
+ @echo off
2
+ SET REDIS_PATH=%~dp0
3
+
4
+ :: BatchGotAdmin
5
+ :-------------------------------------
6
+ REM --> Check for permissions
7
+ >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
8
+
9
+ REM --> If error flag set, we do not have admin.
10
+ if '%errorlevel%' NEQ '0' (
11
+ echo Requesting administrative privileges...
12
+ goto UACPrompt
13
+ ) else ( goto gotAdmin )
14
+
15
+ :UACPrompt
16
+ echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
17
+ echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
18
+ "%temp%\getadmin.vbs"
19
+ exit /B
20
+
21
+ :gotAdmin
22
+ if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
23
+ pushd "%CD%"
24
+ CD /D "%REDIS_PATH%"
25
+ :--------------------------------------
26
+
27
+ echo 1.Please enter the redis installation path
28
+ echo The default is the current path: %REDIS_PATH%
29
+ echo If you don't want to modify it, press Enter
30
+ set /p REDIS_INSTALL_PATH=Installation Path:
31
+
32
+ echo.
33
+
34
+ echo 2.Please enter the redis configuration file path
35
+ echo The default is the current path: %REDIS_PATH%redis.conf
36
+ echo Must be an absolute path
37
+ echo If you don't want to modify it, press Enter
38
+ set /p REDIS_CONF_PATH=Configuration file Path:
39
+
40
+ if defined REDIS_INSTALL_PATH (
41
+ if defined REDIS_CONF_PATH (
42
+ REM Install and Conf
43
+ echo Installation Path: %REDIS_INSTALL_PATH%
44
+ echo Configuration file Path: %REDIS_CONF_PATH%
45
+ pause
46
+ call:existInstallPath
47
+ call:existConfPath
48
+ call:installRedis
49
+ sc.exe create "Redis" binpath="%REDIS_INSTALL_PATH%\RedisService.exe -c %REDIS_CONF_PATH%" start= AUTO
50
+ ) else (
51
+ REM Install
52
+ echo Installation Path: %REDIS_INSTALL_PATH%
53
+ echo Configuration file Path: %REDIS_INSTALL_PATH%\redis.conf
54
+ pause
55
+ call:existInstallPath
56
+ call:installRedis
57
+ sc.exe create "Redis" binpath="%REDIS_INSTALL_PATH%\RedisService.exe" start= AUTO
58
+ )
59
+ ) else (
60
+ if defined REDIS_CONF_PATH (
61
+ REM Conf
62
+ echo Installation Path: %REDIS_PATH%
63
+ echo Configuration file Path: %REDIS_CONF_PATH%
64
+ pause
65
+ call:existConfPath
66
+ sc.exe create "Redis" binpath="%REDIS_PATH%\RedisService.exe -c %REDIS_CONF_PATH%" start= AUTO
67
+ ) else (
68
+ REM null
69
+ echo Installation Path: %REDIS_PATH%
70
+ echo Configuration file Path: %REDIS_PATH%\redis.conf
71
+ pause
72
+ sc.exe create "Redis" binpath="%REDIS_PATH%RedisService.exe" start= AUTO
73
+ )
74
+ )
75
+
76
+ net start "Redis"
77
+ pause
78
+
79
+ :existInstallPath
80
+ if not exist %REDIS_INSTALL_PATH% (
81
+ md %REDIS_INSTALL_PATH%
82
+ if not exist %REDIS_INSTALL_PATH% (
83
+ echo Failed to create folder!
84
+ pause
85
+ exit 1
86
+ )
87
+ )
88
+ goto:eof
89
+
90
+ :existConfPath
91
+ if not exist %REDIS_CONF_PATH% (
92
+ echo Configuration file does not exist!
93
+ pause
94
+ exit 1
95
+ )
96
+ goto:eof
97
+
98
+ :installRedis
99
+ xcopy %REDIS_PATH% %REDIS_INSTALL_PATH% /y
100
+ goto:eof