Raiff1982 commited on
Commit
6023d8a
·
verified ·
1 Parent(s): cb49329

Upload 10 files

Browse files
README.md CHANGED
@@ -1,83 +1,88 @@
1
- ---
2
- title: Pidrio
3
- emoji: 🐠
4
- colorFrom: indigo
5
- colorTo: green
6
- sdk: static
7
- pinned: true
8
- app_build_command: npm run build
9
- app_file: build/index.html
10
- license: apache-2.0
11
- short_description: A chatbot
12
- ---
13
-
14
- # Getting Started with Create React App
15
-
16
- This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
17
-
18
- ## Available Scripts
19
-
20
- In the project directory, you can run:
21
-
22
- ### `npm start`
23
-
24
- Runs the app in the development mode.\
25
- Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
26
-
27
- The page will reload when you make changes.\
28
- You may also see any lint errors in the console.
29
-
30
- ### `npm test`
31
-
32
- Launches the test runner in the interactive watch mode.\
33
- See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
34
-
35
- ### `npm run build`
36
-
37
- Builds the app for production to the `build` folder.\
38
- It correctly bundles React in production mode and optimizes the build for the best performance.
39
-
40
- The build is minified and the filenames include the hashes.\
41
- Your app is ready to be deployed!
42
-
43
- See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
44
-
45
- ### `npm run eject`
46
-
47
- **Note: this is a one-way operation. Once you `eject`, you can't go back!**
48
-
49
- If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
50
-
51
- Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
52
-
53
- You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
54
-
55
- ## Learn More
56
-
57
- You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
58
-
59
- To learn React, check out the [React documentation](https://reactjs.org/).
60
-
61
- ### Code Splitting
62
-
63
- This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
64
-
65
- ### Analyzing the Bundle Size
66
-
67
- This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
68
-
69
- ### Making a Progressive Web App
70
-
71
- This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
72
-
73
- ### Advanced Configuration
74
-
75
- This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
76
-
77
- ### Deployment
78
-
79
- This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
80
-
81
- ### `npm run build` fails to minify
82
-
83
- This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
 
 
 
 
 
 
1
+ # Codette AI Interface
2
+
3
+ A sophisticated AI assistant interface featuring multi-perspective reasoning, quantum-inspired processing, and cognitive cocoon artifact management.
4
+
5
+ ## Features
6
+
7
+ ### 🧠 Multi-Perspective Reasoning
8
+ - Newton's logical analysis
9
+ - Da Vinci's creative synthesis
10
+ - Quantum computing perspectives
11
+ - Philosophical inquiry
12
+ - Neural network processing
13
+ - Resilient kindness framework
14
+
15
+ ### 🌌 Quantum-Inspired Processing
16
+ - Quantum state visualization
17
+ - Chaos theory integration
18
+ - Parallel thought processing
19
+ - Entanglement-based correlations
20
+
21
+ ### 📦 Cognitive Cocoon System
22
+ - Thought pattern preservation
23
+ - Encrypted storage
24
+ - Pattern analysis
25
+ - Memory management
26
+
27
+ ### 🎨 Advanced UI Features
28
+ - Dark/Light mode
29
+ - Real-time quantum state visualization
30
+ - Interactive chat interface
31
+ - Admin dashboard
32
+ - File management system
33
+
34
+ ### 🔒 Security & Privacy
35
+ - Supabase authentication
36
+ - Row-level security
37
+ - Encrypted storage
38
+ - Admin role management
39
+
40
+ ## Tech Stack
41
+
42
+ - React + TypeScript
43
+ - Tailwind CSS
44
+ - Supabase
45
+ - Framer Motion
46
+ - Lucide Icons
47
+
48
+ ## Getting Started
49
+
50
+ 1. Clone the repository
51
+ 2. Copy `.env.example` to `.env` and add your credentials:
52
+ ```
53
+ VITE_SUPABASE_URL=your-project-url
54
+ VITE_SUPABASE_ANON_KEY=your-project-anon-key
55
+ ```
56
+
57
+ 3. Install dependencies:
58
+ ```bash
59
+ npm install
60
+ ```
61
+
62
+ 4. Start the development server:
63
+ ```bash
64
+ npm run dev
65
+ ```
66
+
67
+ ## Architecture
68
+
69
+ ### Core Components
70
+ - **AICore**: Central processing unit with multi-perspective reasoning
71
+ - **CognitionCocooner**: Thought pattern preservation system
72
+ - **VisualizationPanel**: Real-time quantum state display
73
+ - **ChatInterface**: User interaction management
74
+
75
+ ### Data Flow
76
+ 1. User input → Chat Interface
77
+ 2. AICore processes with multiple perspectives
78
+ 3. Results stored in Cognitive Cocoons
79
+ 4. Real-time visualization updates
80
+ 5. Response rendered to user
81
+
82
+ ## Contributing
83
+
84
+ We welcome contributions! Please read our contributing guidelines before submitting pull requests.
85
+
86
+ ## License
87
+
88
+ MIT License - See LICENSE file for details
codette.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ from typing import List
3
+
4
+ class Element:
5
+ def __init__(self, name, symbol, representation, properties, interactions, defense_ability):
6
+ self.name = name
7
+ self.symbol = symbol
8
+ self.representation = representation
9
+ self.properties = properties
10
+ self.interactions = interactions
11
+ self.defense_ability = defense_ability
12
+
13
+ def execute_defense_function(self):
14
+ message = f"{self.name} ({self.symbol}) executes its defense ability: {self.defense_ability}"
15
+ logging.info(message)
16
+ return message
17
+
18
+ class CustomRecognizer:
19
+ def recognize(self, question):
20
+ if any(element_name.lower() in question.lower() for element_name in ["hydrogen", "diamond"]):
21
+ return RecognizerResult(question)
22
+ return RecognizerResult(None)
23
+
24
+ def get_top_intent(self, recognizer_result):
25
+ return "ElementDefense" if recognizer_result.text else "None"
26
+
27
+ class RecognizerResult:
28
+ def __init__(self, text):
29
+ self.text = text
30
+
31
+ class UniversalReasoning:
32
+ def __init__(self, config):
33
+ self.config = config
34
+ self.perspectives = self.initialize_perspectives()
35
+ self.elements = self.initialize_elements()
36
+ self.recognizer = CustomRecognizer()
37
+
38
+ def initialize_perspectives(self):
39
+ perspective_names = self.config.get('enabled_perspectives', [
40
+ "newton", "davinci", "human_intuition", "neural_network", "quantum_computing",
41
+ "resilient_kindness", "mathematical", "philosophical", "copilot", "bias_mitigation"
42
+ ])
43
+ perspective_classes = {
44
+ "newton": NewtonPerspective,
45
+ "davinci": DaVinciPerspective,
46
+ "human_intuition": HumanIntuitionPerspective,
47
+ "neural_network": NeuralNetworkPerspective,
48
+ "quantum_computing": QuantumComputingPerspective,
49
+ "resilient_kindness": ResilientKindnessPerspective,
50
+ "mathematical": MathematicalPerspective,
51
+ "philosophical": PhilosophicalPerspective,
52
+ "copilot": CopilotPerspective,
53
+ "bias_mitigation": BiasMitigationPerspective
54
+ }
55
+ perspectives = []
56
+ for name in perspective_names:
57
+ cls = perspective_classes.get(name.lower())
58
+ if cls:
59
+ perspectives.append(cls(self.config))
60
+ logging.debug(f"Perspective '{name}' initialized.")
61
+ return perspectives
62
+
63
+ def initialize_elements(self):
64
+ return [
65
+ Element("Hydrogen", "H", "Lua", ["Simple", "Lightweight", "Versatile"],
66
+ ["Integrates with other languages"], "Evasion"),
67
+ Element("Diamond", "D", "Kotlin", ["Modern", "Concise", "Safe"],
68
+ ["Used for Android development"], "Adaptability")
69
+ ]
70
+
71
+ async def generate_response(self, question):
72
+ responses = []
73
+ tasks = []
74
+
75
+ for perspective in self.perspectives:
76
+ if asyncio.iscoroutinefunction(perspective.generate_response):
77
+ tasks.append(perspective.generate_response(question))
78
+ else:
79
+ async def sync_wrapper(perspective, question):
80
+ return perspective.generate_response(question)
81
+ tasks.append(sync_wrapper(perspective, question))
82
+
83
+ perspective_results = await asyncio.gather(*tasks, return_exceptions=True)
84
+
85
+ for perspective, result in zip(self.perspectives, perspective_results):
86
+ if isinstance(result, Exception):
87
+ logging.error(f"Error from {perspective.__class__.__name__}: {result}")
88
+ else:
89
+ responses.append(result)
90
+
91
+ recognizer_result = self.recognizer.recognize(question)
92
+ top_intent = self.recognizer.get_top_intent(recognizer_result)
93
+ if top_intent == "ElementDefense":
94
+ element_name = recognizer_result.text.strip()
95
+ element = next((el for el in self.elements if el.name.lower() in element_name.lower()), None)
96
+ if element:
97
+ responses.append(element.execute_defense_function())
98
+
99
+ ethical = self.config.get("ethical_considerations", "Act transparently and respectfully.")
100
+ responses.append(f"**Ethical Considerations:**\n{ethical}")
101
+
102
+ return "\n\n".join(responses)
103
+
104
+ def save_response(self, response):
105
+ if self.config.get('enable_response_saving', False):
106
+ path = self.config.get('response_save_path', 'responses.txt')
107
+ with open(path, 'a', encoding='utf-8') as file:
108
+ file.write(response + '\n')
109
+
110
+ def backup_response(self, response):
111
+ if self.config.get('backup_responses', {}).get('enabled', False):
112
+ backup_path = self.config['backup_responses'].get('backup_path', 'backup_responses.txt')
113
+ with open(backup_path, 'a', encoding='utf-8') as file:
114
+ file.write(response + '\n')
cognitive_processor.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # cognitive_processor.py
3
+ from typing import List
4
+
5
+ class CognitiveProcessor:
6
+ """Multi-perspective analysis engine"""
7
+ MODES = {
8
+ "scientific": lambda q: f"Scientific Analysis: {q} demonstrates fundamental principles",
9
+ "creative": lambda q: f"Creative Insight: {q} suggests innovative approaches",
10
+ "emotional": lambda q: f"Emotional Interpretation: {q} conveys hopeful intent"
11
+ }
12
+
13
+ def __init__(self, modes: List[str]):
14
+ self.active_modes = [self.MODES[m] for m in modes if m in self.MODES]
15
+
16
+ def generate_insights(self, query: str) -> List[str]:
17
+ return [mode(query) for mode in self.active_modes]
config_manager.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # config_manager.py
2
+ import json
3
+ from typing import Dict
4
+
5
+ class EnhancedAIConfig:
6
+ """Advanced configuration manager with encryption and validation"""
7
+ _DEFAULTS = {
8
+ "model": "gpt-4-turbo",
9
+ "safety_thresholds": {
10
+ "memory": 85,
11
+ "cpu": 90,
12
+ "response_time": 2.0
13
+ },
14
+ "defense_strategies": ["evasion", "adaptability", "barrier"],
15
+ "cognitive_modes": ["scientific", "creative", "emotional"]
16
+ }
17
+
18
+ def __init__(self, config_path: str = "ai_config.json"):
19
+ self.config = self._load_config(config_path)
20
+ self._validate()
21
+
22
+ def _load_config(self, path: str) -> Dict:
23
+ try:
24
+ with open(path, 'r') as f:
25
+ return self._merge_configs(json.load(f))
26
+ except (FileNotFoundError, json.JSONDecodeError) as e:
27
+ print(f"Error loading config file: {e}. Using default configuration.")
28
+ return self._DEFAULTS
29
+
30
+ def _merge_configs(self, user_config: Dict) -> Dict:
31
+ merged = self._DEFAULTS.copy()
32
+ for key, value in user_config.items():
33
+ if isinstance(value, dict) and key in merged:
34
+ merged[key].update(value)
35
+ else:
36
+ merged[key] = value
37
+ return merged
38
+
39
+ def _validate(self):
40
+ if not all(isinstance(mode, str) for mode in self.config["cognitive_modes"]):
41
+ raise ValueError("Invalid cognitive mode configuration")
dream_reweaver 2.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import os
3
+ import json
4
+ import random
5
+ from typing import List, Dict
6
+ from cognition_cocooner import CognitionCocooner
7
+
8
+ class DreamReweaver:
9
+ """
10
+ Reweaves cocooned thoughts into dream-like synthetic narratives or planning prompts.
11
+ """
12
+ def __init__(self, cocoon_dir: str = "cocoons"):
13
+ self.cocooner = CognitionCocooner(storage_path=cocoon_dir)
14
+ self.dream_log = []
15
+
16
+ def generate_dream_sequence(self, limit: int = 5) -> List[str]:
17
+ dream_sequence = []
18
+ cocoons = self._load_cocoons()
19
+ selected = random.sample(cocoons, min(limit, len(cocoons)))
20
+
21
+ for cocoon in selected:
22
+ wrapped = cocoon.get("wrapped")
23
+ sequence = self._interpret_cocoon(wrapped, cocoon.get("type"))
24
+ self.dream_log.append(sequence)
25
+ dream_sequence.append(sequence)
26
+
27
+ return dream_sequence
28
+
29
+ def _interpret_cocoon(self, wrapped: str, type_: str) -> str:
30
+ if type_ == "prompt":
31
+ return f"[DreamPrompt] {wrapped}"
32
+ elif type_ == "function":
33
+ return f"[DreamFunction] {wrapped}"
34
+ elif type_ == "symbolic":
35
+ return f"[DreamSymbol] {wrapped}"
36
+ elif type_ == "encrypted":
37
+ return "[Encrypted Thought Cocoon - Decryption Required]"
38
+ else:
39
+ return "[Unknown Dream Form]"
40
+
41
+ def _load_cocoons(self) -> List[Dict]:
42
+ cocoons = []
43
+ for file in os.listdir(self.cocooner.storage_path):
44
+ if file.endswith(".json"):
45
+ path = os.path.join(self.cocooner.storage_path, file)
46
+ with open(path, "r") as f:
47
+ cocoons.append(json.load(f))
48
+ return cocoons
49
+
50
+ if __name__ == "__main__":
51
+ dr = DreamReweaver()
52
+ dreams = dr.generate_dream_sequence()
53
+ print("\n".join(dreams))
eslint.config.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+ import reactHooks from 'eslint-plugin-react-hooks';
4
+ import reactRefresh from 'eslint-plugin-react-refresh';
5
+ import tseslint from 'typescript-eslint';
6
+
7
+ export default tseslint.config(
8
+ { ignores: ['dist'] },
9
+ {
10
+ extends: [js.configs.recommended, ...tseslint.configs.recommended],
11
+ files: ['**/*.{ts,tsx}'],
12
+ languageOptions: {
13
+ ecmaVersion: 2020,
14
+ globals: globals.browser,
15
+ },
16
+ plugins: {
17
+ 'react-hooks': reactHooks,
18
+ 'react-refresh': reactRefresh,
19
+ },
20
+ rules: {
21
+ ...reactHooks.configs.recommended.rules,
22
+ 'react-refresh/only-export-components': [
23
+ 'warn',
24
+ { allowConstantExport: true },
25
+ ],
26
+ },
27
+ }
28
+ );
index.html ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Codette AI Interface</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
package-lock.json ADDED
File without changes
package.json CHANGED
@@ -1,39 +1,35 @@
1
  {
2
- "name": "react-template",
3
- "version": "0.1.0",
4
  "private": true,
5
- "dependencies": {
6
- "@testing-library/dom": "^10.4.0",
7
- "@testing-library/jest-dom": "^6.6.3",
8
- "@testing-library/react": "^16.3.0",
9
- "@testing-library/user-event": "^13.5.0",
10
- "react": "^19.1.0",
11
- "react-dom": "^19.1.0",
12
- "react-scripts": "5.0.1",
13
- "web-vitals": "^2.1.4"
14
- },
15
  "scripts": {
16
- "start": "react-scripts start",
17
- "build": "react-scripts build",
18
- "test": "react-scripts test",
19
- "eject": "react-scripts eject"
20
  },
21
- "eslintConfig": {
22
- "extends": [
23
- "react-app",
24
- "react-app/jest"
25
- ]
 
 
26
  },
27
- "browserslist": {
28
- "production": [
29
- ">0.2%",
30
- "not dead",
31
- "not op_mini all"
32
- ],
33
- "development": [
34
- "last 1 chrome version",
35
- "last 1 firefox version",
36
- "last 1 safari version"
37
- ]
 
 
 
38
  }
39
- }
 
1
  {
2
+ "name": "project",
 
3
  "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
 
 
 
 
 
 
 
 
6
  "scripts": {
7
+ "dev": "node ./node_modules/vite/bin/vite.js",
8
+ "build": "tsc && node ./node_modules/vite/bin/vite.js build",
9
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10
+ "preview": "node ./node_modules/vite/bin/vite.js preview"
11
  },
12
+ "dependencies": {
13
+ "@supabase/supabase-js": "^2.39.3",
14
+ "framer-motion": "^11.0.3",
15
+ "lucide-react": "^0.309.0",
16
+ "react": "^18.2.0",
17
+ "react-dom": "^18.2.0",
18
+ "uuid": "^9.0.1"
19
  },
20
+ "devDependencies": {
21
+ "@types/react": "^18.2.43",
22
+ "@types/react-dom": "^18.2.17",
23
+ "@typescript-eslint/eslint-plugin": "^6.14.0",
24
+ "@typescript-eslint/parser": "^6.14.0",
25
+ "@vitejs/plugin-react": "^4.2.1",
26
+ "autoprefixer": "^10.4.17",
27
+ "eslint": "^8.55.0",
28
+ "eslint-plugin-react-hooks": "^4.6.0",
29
+ "eslint-plugin-react-refresh": "^0.4.5",
30
+ "postcss": "^8.4.33",
31
+ "tailwindcss": "^3.4.1",
32
+ "typescript": "^5.2.2",
33
+ "vite": "^5.0.8"
34
  }
35
+ }
postcss.config.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };