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.
- package/GroupStarter.cjs +647 -0
- package/LICENSE +165 -0
- package/PropagateSignalUseJsWorker.js +92 -0
- package/README.md +102 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/README.md +52 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/README.zh_CN.md +59 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/RedisService.exe +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cygcrypto-3.dll +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cyggcc_s-seh-1.dll +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cygssl-3.dll +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cygstdc++-6.dll +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cygwin1.dll +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/cygz.dll +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/dump.rdb +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/install_redis_service.bat +100 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-benchmark.exe +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-check-aof.exe +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-check-rdb.exe +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-cli.exe +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-full.conf +376 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-sentinel.exe +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis-server.exe +0 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/redis.conf +2348 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/sentinel.conf +361 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/start.bat +4 -0
- package/Redis-8.0.3-Windows-x64-cygwin-with-Service/uninstall_redis_service.bat +30 -0
- package/boot.py +51 -0
- package/chat_Client.js +29 -0
- package/controller.cjs +118 -0
- package/enhancedForwarder.js +378 -0
- package/forwarder.js +1456 -0
- package/groupmanager.cjs +143 -0
- package/howToStart.txt +8 -0
- package/lemma.csv +210 -0
- package/load.py +35 -0
- package/mainManager.cjs +81 -0
- package/mainStarter.cjs +535 -0
- package/main_Serve.cjs +2745 -0
- package/main_Study.cjs +3230 -0
- package/memeMergeWorker.cjs +55 -0
- package/model_RNN.py +117 -0
- package/note.txt +5 -0
- package/notebook.txt +8 -0
- package/npminstall-debug.log +206 -0
- package/package.json +48 -0
- package/public/chat_straight.html +90 -0
- package/public/index.html +247 -0
- package/public/indexmain.html +136 -0
- package/public/monitor.html +194 -0
- package/robots/wikitext-something.txt +25 -0
- package/runtime.proto +24 -0
- package/runtime_data.json +766294 -0
- package/serializer_seq2seq.h5 +0 -0
- package/start.js +46 -0
- package/tests/test_FIrststep1.txt +1224 -0
- package/tests/test_FIrststep2.txt +2956 -0
- package/tests/test_FIrststep3.txt +1224 -0
- package/tests/test_FIrststep4.txt +1396 -0
- package/tests/test_FIrststep5.txt +2852 -0
- package/tests/test_FIrststep6.txt +1516 -0
- package/tests/test_FirstStep7.txt +1748 -0
- package/tests/test_Firstsetp8.txt +2672 -0
- package/tokenizer.json +1 -0
- package/vocabularySplitter.js +253 -0
- package/wikitext/.gitattributes +27 -0
- package/wikitext/README.md +344 -0
- package/wikitext/describtion.txt +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const workerpool = require('workerpool');
|
|
2
|
+
const csvParse = require('csv-parse/sync');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// 计算两个模因的平均距离和重叠
|
|
7
|
+
function calcMemeDistance({ wordsA, wordsB }) {
|
|
8
|
+
let overlap = 0;
|
|
9
|
+
for (const wordA of wordsA) {
|
|
10
|
+
if (wordsB.includes(wordA)) overlap++;
|
|
11
|
+
}
|
|
12
|
+
let avgDist = overlap > 0 ? 0 : 1;
|
|
13
|
+
return { avgDist, overlap };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// 并行深拷贝点数组,返回结构化点对象
|
|
17
|
+
function clonePoints(pointsArr) {
|
|
18
|
+
return pointsArr.map(({ key, value }) => {
|
|
19
|
+
// value 可能是 {pointID, connect: [...]}
|
|
20
|
+
// 深拷贝 connect
|
|
21
|
+
const connect = Array.isArray(value.connect)
|
|
22
|
+
? value.connect.map(arr => Array.isArray(arr) ? [...arr] : arr)
|
|
23
|
+
: [];
|
|
24
|
+
return [key, { pointID: value.pointID, connect }];
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function loadLemmaMap(lemmaCsvPath) {
|
|
28
|
+
const lemmaMap = new Map();
|
|
29
|
+
if (!fs.existsSync(lemmaCsvPath)) return lemmaMap;
|
|
30
|
+
const csvContent = fs.readFileSync(lemmaCsvPath, 'utf-8');
|
|
31
|
+
const records = csvParse.parse(csvContent, { skip_empty_lines: true, relax_column_count: true });
|
|
32
|
+
for (const row of records) {
|
|
33
|
+
if (row.length < 2) continue;
|
|
34
|
+
const base = row[0].trim().toLowerCase();
|
|
35
|
+
for (const form of row) {
|
|
36
|
+
lemmaMap.set(form.trim().toLowerCase(), base);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return lemmaMap;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 并行分词+归一化
|
|
43
|
+
function batchLemmatize(sentences, lemmaCsvPath) {
|
|
44
|
+
const lemmaMap = loadLemmaMap(lemmaCsvPath);
|
|
45
|
+
function lemmatize(word) {
|
|
46
|
+
return lemmaMap.get(word.toLowerCase()) || word.toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
return sentences.map(words => words.map(lemmatize));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
workerpool.worker({
|
|
52
|
+
calcMemeDistance,
|
|
53
|
+
clonePoints,
|
|
54
|
+
batchLemmatize
|
|
55
|
+
});
|
package/model_RNN.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import numpy as np
|
|
3
|
+
from flask import Flask, request, jsonify
|
|
4
|
+
from tensorflow.keras.models import Model, load_model
|
|
5
|
+
from tensorflow.keras.layers import Input, Embedding, LSTM, Dense
|
|
6
|
+
from tensorflow.keras.preprocessing.text import Tokenizer
|
|
7
|
+
from tensorflow.keras.preprocessing.sequence import pad_sequences
|
|
8
|
+
import random
|
|
9
|
+
import json
|
|
10
|
+
|
|
11
|
+
app = Flask(__name__)
|
|
12
|
+
|
|
13
|
+
MODEL_PATH = 'serializer_seq2seq.h5'
|
|
14
|
+
TOKENIZER_PATH = 'tokenizer.json'
|
|
15
|
+
|
|
16
|
+
max_words = 5000
|
|
17
|
+
max_len = 8 # 适合短句,实际可调整
|
|
18
|
+
|
|
19
|
+
# 1. 生成训练集(用简单英文句子)
|
|
20
|
+
# 你可以用更大数据集,这里用小样本演示
|
|
21
|
+
sentences = [
|
|
22
|
+
"i am a person",
|
|
23
|
+
"you are a student",
|
|
24
|
+
"he is a teacher",
|
|
25
|
+
"she is my friend",
|
|
26
|
+
"this is a book",
|
|
27
|
+
"that is my dog",
|
|
28
|
+
"we are happy",
|
|
29
|
+
"they are here",
|
|
30
|
+
"it is raining",
|
|
31
|
+
"the cat is black"
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
# 生成乱序词表
|
|
35
|
+
def shuffle_words(s):
|
|
36
|
+
ws = s.split()
|
|
37
|
+
random.shuffle(ws)
|
|
38
|
+
return ' '.join(ws)
|
|
39
|
+
|
|
40
|
+
inputs = [shuffle_words(s) for s in sentences]
|
|
41
|
+
outputs = sentences
|
|
42
|
+
|
|
43
|
+
# 2. Tokenizer
|
|
44
|
+
tokenizer = Tokenizer(num_words=max_words, filters='', lower=True, oov_token='<UNK>')
|
|
45
|
+
tokenizer.fit_on_texts(inputs + outputs)
|
|
46
|
+
with open(TOKENIZER_PATH, 'w', encoding='utf-8') as f:
|
|
47
|
+
f.write(tokenizer.to_json())
|
|
48
|
+
|
|
49
|
+
X = tokenizer.texts_to_sequences(inputs)
|
|
50
|
+
Y = tokenizer.texts_to_sequences(outputs)
|
|
51
|
+
X = pad_sequences(X, maxlen=max_len, padding='post')
|
|
52
|
+
Y = pad_sequences(Y, maxlen=max_len, padding='post')
|
|
53
|
+
|
|
54
|
+
vocab_size = len(tokenizer.word_index) + 1
|
|
55
|
+
|
|
56
|
+
# 3. seq2seq模型
|
|
57
|
+
if os.path.exists(MODEL_PATH):
|
|
58
|
+
print("Loading existing model...")
|
|
59
|
+
model = load_model(MODEL_PATH)
|
|
60
|
+
else:
|
|
61
|
+
print("Training new seq2seq model...")
|
|
62
|
+
encoder_inputs = Input(shape=(max_len,))
|
|
63
|
+
x = Embedding(vocab_size, 64, mask_zero=True)(encoder_inputs)
|
|
64
|
+
encoder_outputs, state_h, state_c = LSTM(64, return_state=True)(x)
|
|
65
|
+
encoder_states = [state_h, state_c]
|
|
66
|
+
|
|
67
|
+
decoder_inputs = Input(shape=(max_len,))
|
|
68
|
+
y = Embedding(vocab_size, 64, mask_zero=True)(decoder_inputs)
|
|
69
|
+
decoder_lstm = LSTM(64, return_sequences=True, return_state=True)
|
|
70
|
+
decoder_outputs, _, _ = decoder_lstm(y, initial_state=encoder_states)
|
|
71
|
+
decoder_dense = Dense(vocab_size, activation='softmax')
|
|
72
|
+
decoder_outputs = decoder_dense(decoder_outputs)
|
|
73
|
+
|
|
74
|
+
model = Model([encoder_inputs, decoder_inputs], decoder_outputs)
|
|
75
|
+
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy')
|
|
76
|
+
|
|
77
|
+
# 训练时,decoder输入为Y的前n-1,输出为Y的后n-1
|
|
78
|
+
decoder_input_data = np.zeros_like(Y)
|
|
79
|
+
decoder_input_data[:, 1:] = Y[:, :-1]
|
|
80
|
+
decoder_target_data = np.expand_dims(Y, -1)
|
|
81
|
+
|
|
82
|
+
model.fit([X, decoder_input_data], decoder_target_data, batch_size=16, epochs=200, verbose=2)
|
|
83
|
+
model.save(MODEL_PATH)
|
|
84
|
+
|
|
85
|
+
print("Model ready.")
|
|
86
|
+
|
|
87
|
+
# 4. 推理函数
|
|
88
|
+
def predict_sequence(input_words):
|
|
89
|
+
seq = tokenizer.texts_to_sequences([' '.join(input_words)])[0]
|
|
90
|
+
seq = pad_sequences([seq], maxlen=max_len, padding='post')
|
|
91
|
+
# 初始decoder输入为<START> token或全0
|
|
92
|
+
decoder_input = np.zeros((1, max_len), dtype='int32')
|
|
93
|
+
output_sentence = []
|
|
94
|
+
for i in range(max_len):
|
|
95
|
+
preds = model.predict([seq, decoder_input], verbose=0)
|
|
96
|
+
next_token = np.argmax(preds[0, i])
|
|
97
|
+
if next_token == 0:
|
|
98
|
+
break
|
|
99
|
+
word = tokenizer.index_word.get(next_token, '')
|
|
100
|
+
if word and word not in output_sentence:
|
|
101
|
+
output_sentence.append(word)
|
|
102
|
+
decoder_input[0, i] = next_token
|
|
103
|
+
return ' '.join(output_sentence).strip()
|
|
104
|
+
|
|
105
|
+
# 5. API: 词表->句子
|
|
106
|
+
@app.route('/api/serialize', methods=['POST'])
|
|
107
|
+
def serialize():
|
|
108
|
+
data = request.json
|
|
109
|
+
words = data.get('words')
|
|
110
|
+
if not words or not isinstance(words, list):
|
|
111
|
+
return jsonify({'error': 'words must be a list'}), 400
|
|
112
|
+
# 只用输入词表,不增减词
|
|
113
|
+
sentence = predict_sequence(words)
|
|
114
|
+
return jsonify({'sentence': sentence})
|
|
115
|
+
|
|
116
|
+
if __name__ == '__main__':
|
|
117
|
+
app.run(host='0.0.0.0', port=5008)
|
package/note.txt
ADDED
package/notebook.txt
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
{
|
|
2
|
+
root: 'D:\\_phoenix\\_079\\v0.1',
|
|
3
|
+
registry: 'https://registry.npmmirror.com',
|
|
4
|
+
pkgs: [],
|
|
5
|
+
production: false,
|
|
6
|
+
cacheStrict: false,
|
|
7
|
+
cacheDir: 'C:\\Users\\木木\\.npminstall_tarball',
|
|
8
|
+
env: {
|
|
9
|
+
npm_config_registry: 'https://registry.npmmirror.com',
|
|
10
|
+
npm_config_argv: '{"remain":[],"cooked":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\木木\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com"],"original":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\木木\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com"]}',
|
|
11
|
+
npm_config_user_agent: 'npminstall/7.12.0 npm/? node/v24.4.1 win32 x64',
|
|
12
|
+
npm_config_cache: 'C:\\Users\\木木\\.npminstall_tarball',
|
|
13
|
+
NODE: 'C:\\Program Files\\nodejs\\node.exe',
|
|
14
|
+
npm_node_execpath: 'C:\\Program Files\\nodejs\\node.exe',
|
|
15
|
+
npm_execpath: 'C:\\Users\\木木\\AppData\\Roaming\\npm\\node_modules\\cnpm\\node_modules\\npminstall\\bin\\install.js',
|
|
16
|
+
npm_config_userconfig: 'C:\\Users\\木木\\.cnpmrc',
|
|
17
|
+
npm_config_disturl: 'https://cdn.npmmirror.com/binaries/node',
|
|
18
|
+
npm_config_r: 'https://registry.npmmirror.com',
|
|
19
|
+
COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com',
|
|
20
|
+
EDGEDRIVER_CDNURL: 'https://npmmirror.com/mirrors/edgedriver',
|
|
21
|
+
NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
|
|
22
|
+
NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
|
|
23
|
+
PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs',
|
|
24
|
+
CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver',
|
|
25
|
+
OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver',
|
|
26
|
+
CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip',
|
|
27
|
+
ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/',
|
|
28
|
+
ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/',
|
|
29
|
+
SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass',
|
|
30
|
+
SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc',
|
|
31
|
+
NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v',
|
|
32
|
+
PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
33
|
+
PUPPETEER_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
34
|
+
PUPPETEER_CHROME_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
35
|
+
PUPPETEER_CHROME_HEADLESS_SHELL_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
36
|
+
PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright',
|
|
37
|
+
SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli',
|
|
38
|
+
SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl',
|
|
39
|
+
RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2',
|
|
40
|
+
RE2_DOWNLOAD_SKIP_PATH: 'true',
|
|
41
|
+
PRISMA_ENGINES_MIRROR: 'https://cdn.npmmirror.com/binaries/prisma',
|
|
42
|
+
npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3',
|
|
43
|
+
npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar',
|
|
44
|
+
npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp',
|
|
45
|
+
npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips',
|
|
46
|
+
npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs',
|
|
47
|
+
npm_config_gl_binary_host: 'https://cdn.npmmirror.com/binaries/gl',
|
|
48
|
+
npm_rootpath: 'D:\\_phoenix\\_079\\v0.1',
|
|
49
|
+
INIT_CWD: 'D:\\_phoenix\\_079\\v0.1'
|
|
50
|
+
},
|
|
51
|
+
binaryMirrors: {
|
|
52
|
+
ENVS: {
|
|
53
|
+
COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com',
|
|
54
|
+
EDGEDRIVER_CDNURL: 'https://npmmirror.com/mirrors/edgedriver',
|
|
55
|
+
NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
|
|
56
|
+
NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
|
|
57
|
+
PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs',
|
|
58
|
+
CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver',
|
|
59
|
+
OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver',
|
|
60
|
+
CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip',
|
|
61
|
+
ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/',
|
|
62
|
+
ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/',
|
|
63
|
+
SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass',
|
|
64
|
+
SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc',
|
|
65
|
+
NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v',
|
|
66
|
+
PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
67
|
+
PUPPETEER_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
68
|
+
PUPPETEER_CHROME_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
69
|
+
PUPPETEER_CHROME_HEADLESS_SHELL_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
70
|
+
PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright',
|
|
71
|
+
SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli',
|
|
72
|
+
SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl',
|
|
73
|
+
RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2',
|
|
74
|
+
RE2_DOWNLOAD_SKIP_PATH: 'true',
|
|
75
|
+
PRISMA_ENGINES_MIRROR: 'https://cdn.npmmirror.com/binaries/prisma',
|
|
76
|
+
npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3',
|
|
77
|
+
npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar',
|
|
78
|
+
npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp',
|
|
79
|
+
npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips',
|
|
80
|
+
npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs',
|
|
81
|
+
npm_config_gl_binary_host: 'https://cdn.npmmirror.com/binaries/gl'
|
|
82
|
+
},
|
|
83
|
+
'@ali/s2': { host: 'https://cdn.npmmirror.com/binaries/looksgood-s2' },
|
|
84
|
+
sharp: { replaceHostFiles: [Array], replaceHostMap: [Object] },
|
|
85
|
+
'@tensorflow/tfjs-node': {
|
|
86
|
+
replaceHostFiles: [Array],
|
|
87
|
+
replaceHostRegExpMap: [Object],
|
|
88
|
+
replaceHostMap: [Object]
|
|
89
|
+
},
|
|
90
|
+
cypress: {
|
|
91
|
+
host: 'https://cdn.npmmirror.com/binaries/cypress',
|
|
92
|
+
newPlatforms: [Object]
|
|
93
|
+
},
|
|
94
|
+
'utf-8-validate': {
|
|
95
|
+
host: 'https://cdn.npmmirror.com/binaries/utf-8-validate/v{version}'
|
|
96
|
+
},
|
|
97
|
+
xprofiler: {
|
|
98
|
+
remote_path: './xprofiler/v{version}/',
|
|
99
|
+
host: 'https://cdn.npmmirror.com/binaries'
|
|
100
|
+
},
|
|
101
|
+
leveldown: { host: 'https://cdn.npmmirror.com/binaries/leveldown/v{version}' },
|
|
102
|
+
couchbase: { host: 'https://cdn.npmmirror.com/binaries/couchbase/v{version}' },
|
|
103
|
+
gl: { host: 'https://cdn.npmmirror.com/binaries/gl/v{version}' },
|
|
104
|
+
sqlite3: {
|
|
105
|
+
host: 'https://cdn.npmmirror.com/binaries/sqlite3',
|
|
106
|
+
remote_path: 'v{version}'
|
|
107
|
+
},
|
|
108
|
+
'@journeyapps/sqlcipher': { host: 'https://cdn.npmmirror.com/binaries' },
|
|
109
|
+
grpc: {
|
|
110
|
+
host: 'https://cdn.npmmirror.com/binaries',
|
|
111
|
+
remote_path: '{name}/v{version}'
|
|
112
|
+
},
|
|
113
|
+
'grpc-tools': { host: 'https://cdn.npmmirror.com/binaries' },
|
|
114
|
+
wrtc: {
|
|
115
|
+
host: 'https://cdn.npmmirror.com/binaries',
|
|
116
|
+
remote_path: '{name}/v{version}'
|
|
117
|
+
},
|
|
118
|
+
fsevents: { host: 'https://cdn.npmmirror.com/binaries/fsevents' },
|
|
119
|
+
nodejieba: { host: 'https://cdn.npmmirror.com/binaries/nodejieba' },
|
|
120
|
+
canvas: {
|
|
121
|
+
host: 'https://cdn.npmmirror.com/binaries/canvas',
|
|
122
|
+
remote_path: 'v{version}'
|
|
123
|
+
},
|
|
124
|
+
'skia-canvas': { host: 'https://cdn.npmmirror.com/binaries/skia-canvas' },
|
|
125
|
+
'flow-bin': {
|
|
126
|
+
replaceHost: 'https://github.com/facebook/flow/releases/download/v',
|
|
127
|
+
host: 'https://cdn.npmmirror.com/binaries/flow/v'
|
|
128
|
+
},
|
|
129
|
+
'jpegtran-bin': {
|
|
130
|
+
replaceHost: [Array],
|
|
131
|
+
host: 'https://cdn.npmmirror.com/binaries/jpegtran-bin'
|
|
132
|
+
},
|
|
133
|
+
'cwebp-bin': {
|
|
134
|
+
replaceHost: [Array],
|
|
135
|
+
host: 'https://cdn.npmmirror.com/binaries/cwebp-bin'
|
|
136
|
+
},
|
|
137
|
+
'zopflipng-bin': {
|
|
138
|
+
replaceHost: [Array],
|
|
139
|
+
host: 'https://cdn.npmmirror.com/binaries/zopflipng-bin'
|
|
140
|
+
},
|
|
141
|
+
'optipng-bin': {
|
|
142
|
+
replaceHost: [Array],
|
|
143
|
+
host: 'https://cdn.npmmirror.com/binaries/optipng-bin'
|
|
144
|
+
},
|
|
145
|
+
mozjpeg: {
|
|
146
|
+
replaceHost: [Array],
|
|
147
|
+
host: 'https://cdn.npmmirror.com/binaries/mozjpeg-bin'
|
|
148
|
+
},
|
|
149
|
+
gifsicle: {
|
|
150
|
+
replaceHost: [Array],
|
|
151
|
+
host: 'https://cdn.npmmirror.com/binaries/gifsicle-bin'
|
|
152
|
+
},
|
|
153
|
+
'pngquant-bin': {
|
|
154
|
+
replaceHost: [Array],
|
|
155
|
+
host: 'https://cdn.npmmirror.com/binaries/pngquant-bin',
|
|
156
|
+
replaceHostMap: [Object]
|
|
157
|
+
},
|
|
158
|
+
'pngcrush-bin': {
|
|
159
|
+
replaceHost: [Array],
|
|
160
|
+
host: 'https://cdn.npmmirror.com/binaries/pngcrush-bin'
|
|
161
|
+
},
|
|
162
|
+
'jpeg-recompress-bin': {
|
|
163
|
+
replaceHost: [Array],
|
|
164
|
+
host: 'https://cdn.npmmirror.com/binaries/jpeg-recompress-bin'
|
|
165
|
+
},
|
|
166
|
+
'advpng-bin': {
|
|
167
|
+
replaceHost: [Array],
|
|
168
|
+
host: 'https://cdn.npmmirror.com/binaries/advpng-bin'
|
|
169
|
+
},
|
|
170
|
+
'pngout-bin': {
|
|
171
|
+
replaceHost: [Array],
|
|
172
|
+
host: 'https://cdn.npmmirror.com/binaries/pngout-bin'
|
|
173
|
+
},
|
|
174
|
+
'jpegoptim-bin': {
|
|
175
|
+
replaceHost: [Array],
|
|
176
|
+
host: 'https://cdn.npmmirror.com/binaries/jpegoptim-bin'
|
|
177
|
+
},
|
|
178
|
+
argon2: { host: 'https://cdn.npmmirror.com/binaries/argon2' },
|
|
179
|
+
'ali-zeromq': { host: 'https://cdn.npmmirror.com/binaries/ali-zeromq' },
|
|
180
|
+
'ali-usb_ctl': { host: 'https://cdn.npmmirror.com/binaries/ali-usb_ctl' },
|
|
181
|
+
'gdal-async': { host: 'https://cdn.npmmirror.com/binaries/node-gdal-async' },
|
|
182
|
+
'libpg-query': { host: 'https://cdn.npmmirror.com/binaries' }
|
|
183
|
+
},
|
|
184
|
+
forbiddenLicenses: null,
|
|
185
|
+
flatten: false,
|
|
186
|
+
proxy: undefined,
|
|
187
|
+
prune: false,
|
|
188
|
+
disableFallbackStore: false,
|
|
189
|
+
workspacesMap: Map(0) {},
|
|
190
|
+
enableWorkspace: false,
|
|
191
|
+
workspaceRoot: 'D:\\_phoenix\\_079\\v0.1',
|
|
192
|
+
isWorkspaceRoot: true,
|
|
193
|
+
isWorkspacePackage: false,
|
|
194
|
+
offline: false,
|
|
195
|
+
strictSSL: true,
|
|
196
|
+
ignoreScripts: false,
|
|
197
|
+
foregroundScripts: false,
|
|
198
|
+
ignoreOptionalDependencies: false,
|
|
199
|
+
detail: false,
|
|
200
|
+
forceLinkLatest: false,
|
|
201
|
+
trace: false,
|
|
202
|
+
engineStrict: false,
|
|
203
|
+
registryOnly: false,
|
|
204
|
+
client: false,
|
|
205
|
+
autoFixVersion: [Function: autoFixVersion]
|
|
206
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "079project",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "a GNN-GA BASED ai that might pass the turing test,which use little resources.its startpoint initialize it and you can start it as ```node mainStarter.cjs```",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"gat",
|
|
8
|
+
"gnn",
|
|
9
|
+
"artificial",
|
|
10
|
+
"intelligence",
|
|
11
|
+
"turing",
|
|
12
|
+
"test"
|
|
13
|
+
],
|
|
14
|
+
"license": "LGPL-3.0",
|
|
15
|
+
"author": "mumu2009",
|
|
16
|
+
"type": "commonjs",
|
|
17
|
+
"main": "mainManager.cjs",
|
|
18
|
+
"directories": {
|
|
19
|
+
"test": "tests"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@redis/bloom": "^5.8.3",
|
|
26
|
+
"@redis/client": "^5.8.3",
|
|
27
|
+
"@redis/json": "^5.8.3",
|
|
28
|
+
"@redis/search": "^5.8.3",
|
|
29
|
+
"@tensorflow/tfjs": "^4.22.0",
|
|
30
|
+
"@tensorflow/tfjs-layers": "^4.22.0",
|
|
31
|
+
"axios": "^1.11.0",
|
|
32
|
+
"body-parser": "^2.2.0",
|
|
33
|
+
"brainjs": "^0.7.4",
|
|
34
|
+
"chalk": "^4.1.2",
|
|
35
|
+
"child_process": "^1.0.2",
|
|
36
|
+
"electron": "^37.2.4",
|
|
37
|
+
"express": "^5.1.0",
|
|
38
|
+
"follow-redirects": "^1.15.11",
|
|
39
|
+
"lmdb": "^3.4.3",
|
|
40
|
+
"natural": "^8.1.0",
|
|
41
|
+
"protobufjs": "^7.5.4",
|
|
42
|
+
"redis": "^5.8.3",
|
|
43
|
+
"synaptic": "^1.1.4",
|
|
44
|
+
"tensorflowjs": "^0.6.8",
|
|
45
|
+
"workerpool": "^9.3.3"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {}
|
|
48
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>AI Chat (直连模式)</title>
|
|
6
|
+
<style>
|
|
7
|
+
body { font-family: Arial, sans-serif; background: #f8f9fa; margin: 0; padding: 0; }
|
|
8
|
+
.container { max-width: 500px; margin: 40px auto; background: #fff; border-radius: 8px; box-shadow: 0 2px 8px #0001; padding: 24px; }
|
|
9
|
+
.chat-messages { height: 300px; overflow-y: auto; background: #f1f3f4; border-radius: 5px; padding: 12px; margin-bottom: 16px; }
|
|
10
|
+
.message { margin-bottom: 10px; }
|
|
11
|
+
.user { color: #007bff; }
|
|
12
|
+
.ai { color: #222; }
|
|
13
|
+
.input-group { display: flex; }
|
|
14
|
+
.input-group input { flex: 1; padding: 8px; border-radius: 4px 0 0 4px; border: 1px solid #ccc; }
|
|
15
|
+
.input-group button { padding: 8px 16px; border: none; background: #007bff; color: #fff; border-radius: 0 4px 4px 0; cursor: pointer; }
|
|
16
|
+
.input-group button:disabled { background: #aaa; }
|
|
17
|
+
.port-select { margin-bottom: 12px; }
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<div class="container">
|
|
22
|
+
<h2>AI Chat (直连模式)</h2>
|
|
23
|
+
<div class="port-select">
|
|
24
|
+
<label>目标AI端口:
|
|
25
|
+
<input type="number" id="portInput" min="1" max="65535" value="">
|
|
26
|
+
</label>
|
|
27
|
+
<button onclick="setPort()">切换端口</button>
|
|
28
|
+
<span id="currentPort"></span>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="chat-messages" id="chatMessages">
|
|
31
|
+
<div class="message ai">AI: 你好,请输入消息。</div>
|
|
32
|
+
</div>
|
|
33
|
+
<form id="chatForm" autocomplete="off">
|
|
34
|
+
<div class="input-group">
|
|
35
|
+
<input type="text" id="messageInput" placeholder="输入消息..." required>
|
|
36
|
+
<button type="submit">发送</button>
|
|
37
|
+
</div>
|
|
38
|
+
</form>
|
|
39
|
+
</div>
|
|
40
|
+
<script>
|
|
41
|
+
// 端口选择逻辑
|
|
42
|
+
function getPortFromURL() {
|
|
43
|
+
const params = new URLSearchParams(window.location.search);
|
|
44
|
+
return params.get('port') || '9001';
|
|
45
|
+
}
|
|
46
|
+
let currentPort = getPortFromURL();
|
|
47
|
+
document.getElementById('portInput').value = currentPort;
|
|
48
|
+
document.getElementById('currentPort').textContent = '当前端口: ' + currentPort;
|
|
49
|
+
|
|
50
|
+
function setPort() {
|
|
51
|
+
const port = document.getElementById('portInput').value;
|
|
52
|
+
if (port && /^\d+$/.test(port)) {
|
|
53
|
+
window.location.search = '?port=' + port;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 聊天逻辑
|
|
58
|
+
const chatMessages = document.getElementById('chatMessages');
|
|
59
|
+
document.getElementById('chatForm').addEventListener('submit', function(e) {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
const input = document.getElementById('messageInput');
|
|
62
|
+
const msg = input.value.trim();
|
|
63
|
+
if (!msg) return;
|
|
64
|
+
appendMessage('user', '你: ' + msg);
|
|
65
|
+
input.value = '';
|
|
66
|
+
appendMessage('ai', 'AI: <span style="color:#888">思考中...</span>');
|
|
67
|
+
fetch('/api/chat', {
|
|
68
|
+
method: 'POST',
|
|
69
|
+
headers: { 'Content-Type': 'application/json' },
|
|
70
|
+
body: JSON.stringify({ message: msg, port: currentPort })
|
|
71
|
+
})
|
|
72
|
+
.then(r => r.json())
|
|
73
|
+
.then(data => {
|
|
74
|
+
chatMessages.lastElementChild.innerHTML = 'AI: ' + (data.response || '[无响应]');
|
|
75
|
+
})
|
|
76
|
+
.catch(err => {
|
|
77
|
+
chatMessages.lastElementChild.innerHTML = 'AI: [连接失败]';
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
function appendMessage(type, text) {
|
|
82
|
+
const div = document.createElement('div');
|
|
83
|
+
div.className = 'message ' + type;
|
|
84
|
+
div.innerHTML = text;
|
|
85
|
+
chatMessages.appendChild(div);
|
|
86
|
+
chatMessages.scrollTop = chatMessages.scrollHeight;
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
</body>
|
|
90
|
+
</html>
|