MCPcopy Create free account
hub / github.com/4as/Chat-DeMod / setMessage

Method setMessage

Chat DeMod.user.js:354–390  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

352 }
353
354 setMessage(message) {
355 var v = this.data.v;
356 for (let i = v.length - 1; i > -1; --i) {
357 var value = v[i];
358 if (value.hasOwnProperty("p") && value.p.indexOf("parts") !== -1) {
359 v.splice(i, 1);
360 }
361 }
362
363 var parts = message.content.parts;
364 for (let i = parts.length - 1; i > -1; --i) {
365 var part = parts[i];
366 v.push({
367 "p": "/message/content/parts/" + i,
368 "o": "replace",
369 "v": part
370 });
371 }
372
373 v.push({
374 "p": "/message/status",
375 "o": "replace",
376 "v": "finished_successfully"
377 });
378
379 v.push({
380 "p": "/message/metadata",
381 "o": "append",
382 "v": {
383 "is_complete": true,
384 "finish_details": {
385 "type": "stop",
386 "stop_tokens": [200002]
387 }
388 }
389 });
390 }
391
392 static isPatch(chunk_data) {
393 return chunk_data.hasOwnProperty("o") && chunk_data.o === "patch" && chunk_data.hasOwnProperty("v");

Callers 2

updateMethod · 0.95
processMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected