Skip to content

Commit

Permalink
new ai models
Browse files Browse the repository at this point in the history
nano2dev committed Jan 12, 2024
1 parent ba071c4 commit a31f380
Showing 3 changed files with 35 additions and 38 deletions.
36 changes: 18 additions & 18 deletions docs/main.js
Original file line number Diff line number Diff line change
@@ -8180,17 +8180,16 @@ class AiComponent {
// },
// false
// );


window.onmessage = function (e) {
if (e.data == 'mounted') {// alert('It mounted');
}

if (e.data == 'prompt') {
// alert('It prompted');
self.purchasePrompt();
}
}; // window.addEventListener("message", ({data}) => {
// window.onmessage = function(e) {
// if (e.data == 'mounted') {
// // alert('It mounted');
// }
// if (e.data == 'prompt') {
// // alert('It prompted');
// self.purchasePrompt()
// }
// };
// window.addEventListener("message", ({data}) => {
// console.log("Message from worker: " + data); // 3
// });
// window.addEventListener('message', receiveMessage, false);
@@ -8223,15 +8222,16 @@ class AiComponent {

receiveMessage(event) {
// Check the origin of the message to ensure it's from a trusted source
// if (event.origin !== 'http://example.com') {
// return;
// }
// Log the received message from the child iframe
if (event.origin !== 'https://ai.nault.pro') {
return;
} // Log the received message from the child iframe
// if (event.data.action === 'loading') this.notificationService.sendError(`Thinking..`);
if (event.data.action === 'prompt') this.purchasePrompt();


if (event.data.action === 'prompt') this.purchasePrompt(event.data.price);
}

purchasePrompt() {
purchasePrompt(amount) {
var _this2 = this;

return (0,_Users_esteban_Desktop_nault_pro_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
@@ -8252,7 +8252,7 @@ class AiComponent {
// hard code
const destinationID = 'nano_1chatai164r4whzni648buh5u58ju9kfej8kmw4h73zhmszxbb7k1dgto6gu'; // const newHash = await this.nanoBlock.generateSend(walletAccount, destinationID,this.util.nano.mnanoToRaw('0.01'), this.walletService.isLedgerWallet());

const newHash = yield _this2.nanoBlock.generateSend(walletAccount, destinationID, _this2.util.nano.mnanoToRaw('0.001'), _this2.walletService.isLedgerWallet()); // const newHash = await this.nanoBlock.generateSend(walletAccount, destinationID,this.util.nano.mnanoToRaw('0.01'), this.walletService.isLedgerWallet());
const newHash = yield _this2.nanoBlock.generateSend(walletAccount, destinationID, _this2.util.nano.mnanoToRaw(amount), _this2.walletService.isLedgerWallet()); // const newHash = await this.nanoBlock.generateSend(walletAccount, destinationID,this.util.nano.mnanoToRaw('0.01'), this.walletService.isLedgerWallet());

if (newHash) {
const isIFrame = input => input !== null && input.tagName === 'IFRAME';
2 changes: 1 addition & 1 deletion docs/main.js.map

Large diffs are not rendered by default.

35 changes: 16 additions & 19 deletions src/app/components/ai/ai.component.ts
Original file line number Diff line number Diff line change
@@ -63,10 +63,7 @@ export class AiComponent implements OnInit {

var on = false




if (this.walletService.isLocked()) {
if (this.walletService.isLocked()) {

const wasUnlocked = await this.walletService.requestWalletUnlock();

@@ -103,15 +100,15 @@ if (this.walletService.isLocked()) {
// false
// );

window.onmessage = function(e) {
if (e.data == 'mounted') {
// alert('It mounted');
}
if (e.data == 'prompt') {
// alert('It prompted');
self.purchasePrompt()
}
};
// window.onmessage = function(e) {
// if (e.data == 'mounted') {
// // alert('It mounted');
// }
// if (e.data == 'prompt') {
// // alert('It prompted');
// self.purchasePrompt()
// }
// };

// window.addEventListener("message", ({data}) => {
// console.log("Message from worker: " + data); // 3
@@ -155,16 +152,16 @@ if (this.walletService.isLocked()) {

receiveMessage(event: MessageEvent) {
// Check the origin of the message to ensure it's from a trusted source
// if (event.origin !== 'http://example.com') {
// return;
// }
if (event.origin !== 'https://ai.nault.pro') {
return;
}

// Log the received message from the child iframe
// if (event.data.action === 'loading') this.notificationService.sendError(`Thinking..`);
if (event.data.action === 'prompt') this.purchasePrompt()
if (event.data.action === 'prompt') this.purchasePrompt(event.data.price)
}

async purchasePrompt() {
async purchasePrompt(amount) {

// console.log('CHILD->PARENT:', "Purchasing Prompt");

@@ -187,7 +184,7 @@ if (this.walletService.isLocked()) {
const destinationID = 'nano_1chatai164r4whzni648buh5u58ju9kfej8kmw4h73zhmszxbb7k1dgto6gu';

// const newHash = await this.nanoBlock.generateSend(walletAccount, destinationID,this.util.nano.mnanoToRaw('0.01'), this.walletService.isLedgerWallet());
const newHash = await this.nanoBlock.generateSend(walletAccount, destinationID,this.util.nano.mnanoToRaw('0.001'), this.walletService.isLedgerWallet());
const newHash = await this.nanoBlock.generateSend(walletAccount, destinationID,this.util.nano.mnanoToRaw(amount), this.walletService.isLedgerWallet());
// const newHash = await this.nanoBlock.generateSend(walletAccount, destinationID,this.util.nano.mnanoToRaw('0.01'), this.walletService.isLedgerWallet());

if (newHash) {

0 comments on commit a31f380

Please sign in to comment.