MCPcopy
hub / github.com/mudler/LocalAI / addTranscript

Function addTranscript

core/http/static/talk.js:112–136  ·  view source on GitHub ↗
(role, text)

Source from the content-addressed store, hash-verified

110let streamingEntry = null;
111
112function addTranscript(role, text) {
113 // Remove the placeholder if present
114 const placeholder = transcript.querySelector('.italic');
115 if (placeholder) placeholder.remove();
116
117 const entry = document.createElement('div');
118 entry.className = 'flex items-start space-x-2';
119
120 const icon = document.createElement('i');
121 const msg = document.createElement('p');
122 msg.className = 'text-[var(--color-text-primary)]';
123 msg.textContent = text;
124
125 if (role === 'user') {
126 icon.className = 'fa-solid fa-user text-[var(--color-primary)] mt-1 flex-shrink-0';
127 } else {
128 icon.className = 'fa-solid fa-robot text-[var(--color-accent)] mt-1 flex-shrink-0';
129 }
130
131 entry.appendChild(icon);
132 entry.appendChild(msg);
133 transcript.appendChild(entry);
134 transcript.scrollTop = transcript.scrollHeight;
135 return entry;
136}
137
138function updateStreamingTranscript(role, delta) {
139 if (!streamingEntry) {

Callers 4

handleServerEventFunction · 0.85
sendTestToneFunction · 0.85

Calls 2

createElementMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected