Skip to content

Commit

Permalink
remove console.log diagnostics from access token issue
Browse files Browse the repository at this point in the history
  • Loading branch information
martypdx committed Oct 27, 2023
1 parent 272d7bf commit 28b6561
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
4 changes: 0 additions & 4 deletions src/services/spirit-wave.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,5 @@ const API_KEY_QUERY = API_KEY ? `?apikey=${encodeURIComponent(API_KEY)}` : '';

const getUrl = path => `${API}${path}${API_KEY_QUERY}`;

console.log('API URL', API);
console.log('API KEY', API_KEY_QUERY);


export const streamGreeting = getStream(getUrl('/greeting'));
export const streamInvocation = getStream(getUrl('/invocation'));
3 changes: 0 additions & 3 deletions supabase/functions/_lib/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export async function streamCompletion(

if (!ok) {
const text = await res.text();
console.log('open AI call failed', text);
return new Response(text, {
headers: {
...corsHeaders,
Expand All @@ -40,8 +39,6 @@ export async function streamCompletion(
});
}

console.log('openAI call succeeded');

const stream = (
body
?.pipeThrough(new TextDecoderStream())
Expand Down
6 changes: 3 additions & 3 deletions supabase/functions/_lib/streams.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

export class OpenAIContentStream extends TransformStream {
// test cases: https://regex101.com/r/Bg9fLQ/1
static contentRegEx = /data: {.+"delta":{"content":(".+")}/gm;

constructor() {
super({
transform(chunk, controller) {
const matches = chunk.matchAll(OpenAIContentStream.contentRegEx);
const matches = chunk.matchAll(
OpenAIContentStream.contentRegEx,
);
try {
for (const [, group] of matches) {
// parse the JSON to decode
Expand All @@ -26,7 +27,6 @@ export class LogStdOutStream extends TransformStream {
constructor() {
super({
transform(chunk, controller) {
console.log(chunk);
// supabase doesn't appear to route stdout to console ?!? :(
// Deno.stdout.write(new TextEncoder().encode(chunk));
controller.enqueue(chunk);
Expand Down

0 comments on commit 28b6561

Please sign in to comment.