@deepsweet/mdn 0.1.2 → 0.1.3
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/dist/index.js +20 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -105,6 +105,9 @@ var getLlamaContext = async (modelPath) => {
|
|
|
105
105
|
batchSize: MAX_TOKENS,
|
|
106
106
|
threads: 0
|
|
107
107
|
});
|
|
108
|
+
context.onDispose.createOnceListener(() => {
|
|
109
|
+
model.dispose().then(() => llama.dispose()).catch(console.error);
|
|
110
|
+
});
|
|
108
111
|
return context;
|
|
109
112
|
};
|
|
110
113
|
|
|
@@ -131,7 +134,7 @@ var createReranker = async () => {
|
|
|
131
134
|
|
|
132
135
|
// package.json
|
|
133
136
|
var name = "@deepsweet/mdn";
|
|
134
|
-
var version = "0.1.
|
|
137
|
+
var version = "0.1.3";
|
|
135
138
|
|
|
136
139
|
// src/server.ts
|
|
137
140
|
var startMcpServer = async () => {
|
|
@@ -171,6 +174,22 @@ var startMcpServer = async () => {
|
|
|
171
174
|
};
|
|
172
175
|
});
|
|
173
176
|
const transport = new StdioServerTransport;
|
|
177
|
+
const dispose = async () => {
|
|
178
|
+
if (llamaTimeout !== null) {
|
|
179
|
+
clearTimeout(llamaTimeout);
|
|
180
|
+
}
|
|
181
|
+
if (llamaContext !== null) {
|
|
182
|
+
await llamaContext.dispose();
|
|
183
|
+
}
|
|
184
|
+
db.close();
|
|
185
|
+
await server.close();
|
|
186
|
+
};
|
|
187
|
+
transport.onclose = () => {
|
|
188
|
+
dispose().catch(console.error);
|
|
189
|
+
};
|
|
190
|
+
transport.onerror = (err) => {
|
|
191
|
+
console.log(err);
|
|
192
|
+
};
|
|
174
193
|
await server.connect(transport);
|
|
175
194
|
};
|
|
176
195
|
|