# Project export: Delulu Bot

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 10.0
- Tagline: We created a project for fun which is aimed to mirror the energy which someone wishes to receive in response to their thoughts.
- Devpost: https://devpost.com/software/delulu-bot
- GitHub: https://github.com/Ayumad/delusion-chat-bot
- Team: 2 GitHub contributor(s) — Ayumad (3 commits), Nimita Mishra (3 commits)

## Devpost submission (written by the team)

### Inspiration

We wanted to create something which would bring joy to us and anyone else who tried out project. Since AI is all the craze these days, we thought it would be a fun twist to have a chatbot which is a bit different from the usual kind and responses with more sass/sarcasm and young people friendly slang.

### What it does

The user records a voice message about anything they wish to share, ask about, or are just thinking of in general. Then our chatbot replied in kind, mirroring the kind of energy it detects. If the user is nervous, it reassures. If the user is confident, it boosts their ego and thinking to make them feel even better. Essentially taking on the role of a super supportive close friend.

### How we built it

We first used React and Python to build a basis website for our chatbot. We then added functionality to record and store audio. After that, we made it so that the audio on submission would call our Hume.AI API. We had trained a model on Hume.ai to detect sentiment (nervous, confident, etc) so that we could use this to determine the mood that the AI should respond with. Once the sentiment of the audio file was analyzed, it was sent back though Together.AI where we used the returned sentiment and confidence score to formulate a response with emojis and right type of vibe.

### Challenges we ran into

We faced a bit of uncertainty when it came to the implementation and understanding of the Hume.AI API implementation as it related to our site. We were not highly familar with React nor Python, so setting up the site also took quite a bit of effort on our end. Overall it was a push of our knowledge and experience.

### Accomplishments we're proud of

Since this project was a push on our capabilities, we are insanely proud of being able to have a functioning product to the level that it is. It was so fulfilling to be able to watch our known knowledge increase and grow along with the codebase.

### What we learned

We learned more about React, Python, and utilizing Ai models for our personal usecases, especially in the form of training them.

### What's next

In the future we plan to improve the site UI/UX, add in functionality for negative thoughts being respoonsed to with either redirection to therapists or therapy bot, and improved responses maybe in the form of the chatbot sending voice messages back in response.

## README (from the GitHub repository)

No README available.

## Detected evidence (automated analysis)

Indexed codebase: 14 recognized source files, 15 KB.
- CSS (language) — detected in the code
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- Python (language) — detected in the code
- React (technology) — detected in the code

## Codebase structure (from repository index)

### Files (19 of 19)

```
delulu/.gitignore
delulu/package.json
delulu/public/index.html
delulu/public/manifest.json
delulu/public/robots.txt
delulu/README.md
delulu/src/App.css
delulu/src/App.js
delulu/src/App.test.js
delulu/src/backend.py
delulu/src/ChatBox.js
delulu/src/ChatBoxTest.js
delulu/src/index.css
delulu/src/index.js
delulu/src/Message.js
delulu/src/reportWebVitals.js
delulu/src/setupTests.js
delulu/src/SpeechProsody.py
delulu/src/your_hume_module
```

### Dependencies

- delulu/package.json: @testing-library/jest-dom@^5.17.0, @testing-library/react@^13.4.0, @testing-library/user-event@^13.5.0, react@^18.2.0, react-dom@^18.2.0, react-scripts@^5.0.1, web-vitals@^2.1.4

### Recent commits (newest first)

- together implementation
- Merge branch 'main' of https://github.com/Ayumad/delusion-chat-bot
- update site pink
- Delete packagelock.json
- Updated site
- create delulu chatbot

## Key source files (fetched from GitHub, selected and truncated for size)

### delulu/package.json

```
{
  "name": "delulu",
  "version": "0.1.0",
  "private": true,
  "proxy": "https://api.hume.ai",
  "dependencies": {
    "@testing-library/jest-dom": "^5.17.0",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "^5.0.1",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

```

### delulu/src/App.js

```javascript
import React from 'react';
import './App.css';
import ChatBox from './ChatBox';

function App() {
  return (
    <div className="App">
      <div className='Header'>
        <h1 id='productName'>Delusion Bot</h1>
        <h3>Your AI Delusional Bestie!</h3>
      </div>
      <ChatBox />
    </div>
  );
}

export default App;

```

### delulu/src/index.js

```javascript
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

```

### delulu/src/Message.js

```javascript
import React from 'react';

function Message({ sender, text }) {
  return (
    <div className={`message ${sender}`}>
      <p>{text}</p>
    </div>
  );
}

export default Message;

```

### delulu/src/setupTests.js

```javascript
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

```

### delulu/src/App.test.js

```javascript
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
  render(<App />);
  const linkElement = screen.getByText(/learn react/i);
  expect(linkElement).toBeInTheDocument();
});

```

### delulu/src/reportWebVitals.js

```javascript
const reportWebVitals = onPerfEntry => {
  if (onPerfEntry && onPerfEntry instanceof Function) {
    import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
      getCLS(onPerfEntry);
      getFID(onPerfEntry);
      getFCP(onPerfEntry);
      getLCP(onPerfEntry);
      getTTFB(onPerfEntry);
    });
  }
};

export default reportWebVitals;

```

### delulu/src/index.css

```css
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
}

```

### delulu/src/SpeechProsody.py

```python
import asyncio

from hume import HumeStreamClient, StreamSocket
from hume.models.config import ProsodyConfig

async def main():
    client = HumeStreamClient(
        "ZOYDAGJtcZ41Aw0vf1f3RQmjUbyYR0vzGlusUuVgDICxXv1m")
    config = ProsodyConfig()
    async with client.connect([config]) as socket:
        result = await socket.send_file("/Users/ayumad/delulu recordings")
        print(result)

asyncio.run(main())
```

### delulu/src/backend.py

```python
from flask import Flask, request, jsonify
from your_hume_module import HumeBatchClient
from flask_cors import CORS

app = Flask(__name__)
CORS(app)

@app.route('/process_audio', methods=['POST'])
def process_audio():
    audio_file = request.files.get('audio')
    
    # Initialize the HumeBatchClient
    client = HumeBatchClient(api_key="YOUR_API_KEY")
    
    # Process the audio file using the HumeBatchClient
    # This is a high-level example; you'll need to adapt it to the actual API methods
    job = client.create_job(audio_file)
    job.await_complete()
    predictions = job.get_predictions()
    
    return jsonify(predictions)

if __name__ == '__main__':
    app.run(debug=True)

```

[3 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]