MCPcopy
hub / github.com/ChatGPTNextWeb/NextChat / prettyObject

Function prettyObject

app/utils/format.ts:1–13  ·  view source on GitHub ↗
(msg: any)

Source from the content-addressed store, hash-verified

1export function prettyObject(msg: any) {
2 const obj = msg;
3 if (typeof msg !== "string") {
4 msg = JSON.stringify(msg, null, " ");
5 }
6 if (msg === "{}") {
7 return obj.toString();
8 }
9 if (msg.startsWith("```json")) {
10 return msg;
11 }
12 return ["```json", msg, "```"].join("\n");
13}
14
15export function* chunks(s: string, maxBytes = 1000 * 1000) {
16 const decoder = new TextDecoder("utf-8");

Callers 15

onopenMethod · 0.90
onopenMethod · 0.90
onopenMethod · 0.90
_ChatFunction · 0.90
openaiSpeechFunction · 0.90
onRenderMsgsFunction · 0.90
onopenFunction · 0.90
onErrorFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected