Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoudz committed Mar 13, 2024
1 parent f7b4fc3 commit 0d073f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/VuicButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const VuicButton = ({ buttonText = 'Record', ...props }) => {

return (
<button onClick={handleButtonClick} {...props}>
MEGA 1 {buttonText}
{buttonText}
</button>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/VuicProvider.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
import Vuic from './vuic';
import Vuic from './core/vuic';
import { VuicContext } from './VuicContext';

const VuicProvider = ({ apiKey, children }) => {
Expand Down
16 changes: 8 additions & 8 deletions src/vuic.js → src/core/vuic.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// src/vuic.js
// src/core/vuic.js
class Vuic {
constructor(key) {
console.log('---[VUIC]--- constructor');
console.log('--[VUIC]-- constructor');
if (!key) {
console.log('A client_key must be provided');
throw new Error('A client_key must be provided');
Expand All @@ -12,14 +12,14 @@ class Vuic {
}

registerFunctions(functionSignatures, functionReferences) {
console.log('---[VUIC]--- registerFunctions');
console.log('--[VUIC]-- registerFunctions');
this.functionSignatures = functionSignatures;
this.functionReferences = functionReferences;
}

// // for vanilla JS
// createVoiceButton(options) {
// console.log('---[VUIC]--- createVoiceButton');
// console.log('--[VUIC]-- createVoiceButton');
// const button = document.createElement('button');
// button.innerText = options.text || 'Talk to me';
// button.addEventListener('click', () => {
Expand All @@ -29,7 +29,7 @@ class Vuic {
// }

startVoiceRecording = async () => {
console.log('---[VUIC]--- startVoiceRecording');
console.log('--[VUIC]-- startVoiceRecording');
if (!window.MediaRecorder) {
console.error('MediaRecorder is not supported by this browser.');
return;
Expand Down Expand Up @@ -61,7 +61,7 @@ class Vuic {
};

_processVoiceCommand = async (audioBlob) => {
console.log('---[VUIC]--- _processVoiceCommand');
console.log('--[VUIC]-- _processVoiceCommand');
const formData = new FormData();
formData.append('audio', audioBlob);
formData.append(
Expand All @@ -79,7 +79,7 @@ class Vuic {
};

_handleProcessedVoiceCommandResponse = (response) => {
console.log('---[VUIC]--- _handleProcessedVoiceCommandResponse');
console.log('--[VUIC]-- _handleProcessedVoiceCommandResponse');
console.log('@ RAW RESPONSE:', response);

if (response && response.actions && Array.isArray(response.actions)) {
Expand Down Expand Up @@ -107,7 +107,7 @@ class Vuic {
};

_executeFunctions = (message) => {
console.log('---[VUIC]--- _executeFunctions');
console.log('--[VUIC]-- _executeFunctions');
const toolCalls = message.tool_calls;
toolCalls.forEach((toolCall) => {
const functionName = toolCall.function.name;
Expand Down

0 comments on commit 0d073f8

Please sign in to comment.