Skip to content

Commit

Permalink
Merge pull request #66 from hilja-org/remove-console-logs
Browse files Browse the repository at this point in the history
Remove console logs
  • Loading branch information
PetroSilenius authored Nov 12, 2023
2 parents 34ea0df + 0fa4c2c commit fb26263
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 44 deletions.
1 change: 0 additions & 1 deletion app/actions/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export async function POST(data: FormData) {
let threadCreated = false;

if (!threadId) {
console.log("CREATING THREAD!!!!!");
const thread = await openai.beta.threads.create();
threadId = thread.id;

Expand Down
2 changes: 0 additions & 2 deletions app/service/pollopenaistatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const getMessages = async (

const run = await openai.beta.threads.runs.retrieve(threadId, runId);
if (run.status === OpenAIRunStatus.COMPLETED) {
console.log("completed");
const openAiResponse = await openai.beta.threads.messages.list(threadId);
const messages = openAiResponse.data.map((message) => {
return {
Expand All @@ -55,7 +54,6 @@ export const getMessages = async (
function: { name, arguments: argsString },
}): Promise<RunSubmitToolOutputsParams.ToolOutput> => ({
tool_call_id: id,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unused-vars
output: await (
functions[name] ??
Throw(`Implement support for function "${name}"`)
Expand Down
4 changes: 2 additions & 2 deletions components/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export default function Message({
<Image
src={`https://img.youtube.com/vi/${
youtubeLinks[0].split("=")[1]
}/0.jpg`}
}/maxresdefault.jpg`}
alt=""
width="100"
height="60"
height="56"
/>
)}
</div>
Expand Down
7 changes: 1 addition & 6 deletions components/MessageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,11 @@ export default function MessageContainer({ threadId }: { threadId: string }) {
}
}

console.log("DEBUG RUN ID", runId);

useEffect(() => {
console.log("DEBUG EFFECt", runId);
if (runId === undefined) return;

fetchMessages(threadId)
.then(({ messages }) => {
console.log(messages);

deleteAllCookies();
setMessages(messages);
})
Expand All @@ -90,7 +85,7 @@ export default function MessageContainer({ threadId }: { threadId: string }) {
<Image
key={index}
src={message.image_file.file_id}
alt="generated bio"
alt=""
className="rounded-xl shadow-md"
/>
);
Expand Down
28 changes: 1 addition & 27 deletions components/VoiceInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
"use client";

import { useEffect, useState } from "react";
Expand All @@ -18,17 +17,14 @@ export default function VoiceInput() {
}, []);

const onAudioInputStart = () => {
console.log("DEBUG", recognition);
setIsListening(true);
if (!recognition) {
// Either not initialized, or already listening - do nothing
} else {
recognition.onresult = (endEvent) => {
console.log("SPEECH RESULTS", endEvent);
const result = endEvent.results?.[0]?.[0];
if (result) {
if (result.confidence > 0.5) {
console.log("Was confident enough to set", result);
// We are confident enough to send this to API

const $ = document.querySelector.bind(document); // You know this shouldn't be here
Expand Down Expand Up @@ -64,37 +60,15 @@ const initWebSpeech = () => {

const recognition = new recognitionCtor();

// const grammarListCtor =
// window.SpeechGrammarList || window.webkitSpeechGrammarList;
// const grammarList = new grammarListCtor();
// grammarList.addFromString(
// "#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;",
// 1,
// );

// recognition.grammars = grammarList;
recognition.continuous = false;
recognition.lang = "en-US";
recognition.interimResults = false;
recognition.maxAlternatives = 1;

recognition.onresult = null;
recognition.onspeechend = (evt) => {
// eslint-disable-next-line no-console
console.log("DEBUG: SPEECH END", evt);
recognition.onspeechend = () => {
recognition.stop();
};
recognition.onnomatch = (evt) => {
// eslint-disable-next-line no-console
console.log("DEBUG: SPEECH NO MATCH", evt);
};
recognition.onerror = (evt) => {
// eslint-disable-next-line no-console
console.log("DEBUG: SPEECH ERROR", evt);
};

return recognition;

// const SpeechRecognitionEvent =
// window.SpeechRecognitionEvent || window.webkitSpeechRecognitionEvent;
};
7 changes: 1 addition & 6 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ module.exports = {
return [
{
source: '/github',
destination: 'https://github.com/Nutlope/twitterbio',
permanent: false,
},
{
source: '/deploy',
destination: 'https://vercel.com/templates/next.js/twitter-bio',
destination: 'https://github.com/hilja-org/hilja',
permanent: false,
},
];
Expand Down

0 comments on commit fb26263

Please sign in to comment.