everydaytok commited on
Commit
04030c6
·
verified ·
1 Parent(s): 9f50718

Update aiEngine.js

Browse files
Files changed (1) hide show
  1. aiEngine.js +3 -3
aiEngine.js CHANGED
@@ -20,7 +20,7 @@ const flattenHistory = (history, currentInput, systemPrompt) => {
20
  };
21
 
22
  const handleStreamResponse = async (response, onThink, onOutput) => {
23
- if (!response.ok) throw new Error(`Remote Stream Error: ${response.statusText}`);
24
  const reader = response.body.getReader();
25
  const decoder = new TextDecoder("utf-8");
26
  let fullText = "";
@@ -41,13 +41,13 @@ const handleStreamResponse = async (response, onThink, onOutput) => {
41
  fullText += chunk;
42
  }
43
  }
44
- } catch (e) { console.error("Stream reader crashed:", e.message); }
45
  return { text: fullText, usage: { totalTokenCount: 0 } };
46
  };
47
 
48
  export const AIEngine = {
49
  callPMStream: async (history, input, onThink, onOutput) => {
50
- const systemPrompt = prompts.pm_system_prompt || "You are a pro manager.";
51
  const response = await fetch(`${REMOTE_SERVER_URL}/api/stream`, {
52
  method: 'POST',
53
  headers: { 'Content-Type': 'application/json' },
 
20
  };
21
 
22
  const handleStreamResponse = async (response, onThink, onOutput) => {
23
+ if (!response.ok) throw new Error(`Stream Error: ${response.statusText}`);
24
  const reader = response.body.getReader();
25
  const decoder = new TextDecoder("utf-8");
26
  let fullText = "";
 
41
  fullText += chunk;
42
  }
43
  }
44
+ } catch (e) { console.error("Stream reader error:", e.message); }
45
  return { text: fullText, usage: { totalTokenCount: 0 } };
46
  };
47
 
48
  export const AIEngine = {
49
  callPMStream: async (history, input, onThink, onOutput) => {
50
+ const systemPrompt = prompts.pm_system_prompt || "You are a lead lead architect.";
51
  const response = await fetch(`${REMOTE_SERVER_URL}/api/stream`, {
52
  method: 'POST',
53
  headers: { 'Content-Type': 'application/json' },