Compare commits

..

No commits in common. "2ca068916797602e16fce642bd942e2addcbd8ce" and "a2c960b7105ed9b78816a8df163c1c89996a3268" have entirely different histories.

14 changed files with 1 additions and 248 deletions

4
.gitignore vendored
View file

@ -35,6 +35,4 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts
.idea/
venv/
api_key.txt

View file

@ -1,39 +0,0 @@
// import React, { useState, useRef } from 'react'
// const AudioRecorder: React.FC = () => {
// const [isRecording, setIsRecording] = useState(false)
// const [audioURL, setAudioURL] = useState<string | null>(null)
// const medaRecorderRef = useRef<MediaRecorder | null>(null)
// const audioChunks = useRef<Blob[]>([])
// const startRecording = async () => {
// const stream = await navigator.mediaDevices.getUserMedia({ audio: true })
// const mediaRecorder = new MediaRecorder(stream)
// medaRecorderRef.current = mediaRecorder
// mediaRecorder.ondataavailable = (event) => {
// audioChunks.current.push(event.data)
// }
// mediaRecorder.onstop = () => {
// const audioBlob = new Blob(audioChunks.current, { type: "audio/wav" })
// const url = URL.createObjectURL(audioBlob)
// setAudioURL(url)
// audioChunks.current = []
// }
// mediaRecorder.start()
// setIsRecording(true)
// const stopRecording = () => {
// medaRecorderRef.current?.stop()
// setIsRecording(false)
// }
// return (
// <div></div>
// )
// }
// }
// export default AudioRecorder

View file

@ -1,2 +0,0 @@
import React from "react";
import axios from 'axios';

100
package-lock.json generated
View file

@ -9,7 +9,6 @@
"version": "0.1.0",
"dependencies": {
"@mistralai/mistralai": "^1.0.4",
"axios": "^1.7.7",
"fs": "^0.0.1-security",
"next": "14.2.12",
"ollama": "^0.5.9",
@ -1049,12 +1048,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"license": "MIT"
},
"node_modules/available-typed-arrays": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
@ -1081,17 +1074,6 @@
"node": ">=4"
}
},
"node_modules/axios": {
"version": "1.7.7",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz",
"integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/axobject-query": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz",
@ -1298,18 +1280,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"license": "MIT",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/commander": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
@ -1517,15 +1487,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"license": "MIT",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/didyoumean": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
@ -2355,26 +2316,6 @@
"dev": true,
"license": "ISC"
},
"node_modules/follow-redirects": {
"version": "1.15.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"license": "MIT",
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/for-each": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
@ -2402,20 +2343,6 @@
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"license": "MIT",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fs": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
@ -3492,27 +3419,6 @@
"node": ">=8.6"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@ -4165,12 +4071,6 @@
"react-is": "^16.13.1"
}
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"license": "MIT"
},
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",

View file

@ -10,7 +10,6 @@
},
"dependencies": {
"@mistralai/mistralai": "^1.0.4",
"axios": "^1.7.7",
"fs": "^0.0.1-security",
"next": "14.2.12",
"ollama": "^0.5.9",

3
py/.idea/.gitignore vendored
View file

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

View file

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.12" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/py.iml" filepath="$PROJECT_DIR$/.idea/py.iml" />
</modules>
</component>
</project>

View file

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PackageRequirementsSettings">
<option name="versionSpecifier" value="Greater or equal (&gt;=x.y.z)" />
</component>
</module>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View file

@ -1,51 +0,0 @@
from flask import Flask, request, jsonify
import ollama
class AI:
@staticmethod
def process_local(model, message, system, return_class, access_token):
stream = ollama.chat(
model=model,
messages=[{'role': 'user', 'content': message}, {'role': 'system', 'content': system}],
stream=True,
)
for chunk in stream:
print(chunk['message']['content'])
return_class.ai_response[access_token] += chunk['message']['content']
class API:
def __init__(self):
self.app = Flask(__name__)
self.ai_response = []
self.ai = AI()
def run(self):
@self.app.route('/interstellar/api/ai_create', methods=['GET'])
def create_ai():
self.ai_response.append("")
return jsonify({'status': 200, 'access_token': len(self.ai_response) - 1})
@self.app.route('/interstellar/api/ai_send', methods=['POST'])
def send_ai():
data = request.get_json()
message = data.get('message')
ai_model = data.get('ai_model')
system_prompt = data.get('system_prompt')
access_token = data.get('access_token')
self.ai.process_local(ai_model, message, system_prompt, self, access_token)
return jsonify({'status': 200})
@self.app.route('/interstellar/api/ai_get', methods=['GET'])
def get_ai():
data = request.args.get('access_token')
return jsonify({'status': 200, 'response': self.ai_response[int(data)]})
self.app.run(debug=True)
if __name__ == '__main__':
api = API()
api.run()

View file

@ -1,4 +0,0 @@
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
deactivate

View file

@ -1,2 +0,0 @@
flask
ollama