import axios from 'axios'
import { ReadStream } from 'fs'
import OpenAI from 'openai'
import { ZodType } from 'zod'
import {
OpenaiGenerateTextOptions,
OpenaiProvider,
} from './providers/openai/openai.provider'
#!/bin/bash | |
set -euo pipefail | |
# ------------------------------- | |
# 1. Verify Required Environment Variables | |
# ------------------------------- | |
REQUIRED_VARS=("OPENAI_API_KEY" "ANTHROPIC_API_KEY") | |
for VAR in "${REQUIRED_VARS[@]}"; do | |
if [ -z "${!VAR:-}" ]; then | |
echo "Error: Required environment variable '$VAR' is not set." |
gzip on; | |
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml; | |
# Browser preferred language detection (does NOT require AcceptLanguageModule) | |
map $http_accept_language $accept_language { | |
default en; | |
~*^en en; | |
~*^ar ar; | |
} |
{ | |
"_id" : "HO00001421", | |
"theatres" : [ | |
{ | |
"_id" : ObjectId("61143e628284301a1db96afd"), | |
"title" : { | |
"text" : "Paw Patrol: The Movie", | |
"translations" : [] | |
}, | |
"genreIds" : [ |
const document_create = async (req, res, next) => { | |
try { | |
console.log("routeLog", "document_create"); | |
console.log(req.body, "body") | |
const CPMRN = req.params.CPMRN; | |
const encounters = req.params.encounters; | |
const tags = req.body.props.tags; | |
const attributes = req.body.props.attributes; |
version: '2' | |
services: | |
influxdb: | |
container_name: influxdb | |
image: docker.io/bitnami/influxdb:1-debian-10 | |
environment: | |
- 'INFLUXDB_ADMIN_USER_PASSWORD=influxdb' | |
- 'K6_INFLUXDB_USERNAME=admin' | |
ports: |
switch (data.type) { | |
case 'offer': | |
// Doctor will initiate the offer | |
// console.log('msg received', Object.keys(this.connections), data, connection.userData); | |
// if UserB exists then send him offer detail | |
// TODO: if patient has joined then send the offer. else send message that patient not available | |
// to check patient has joined | |
// get oversides connection | |
if (aptData && aptData.userConnectionId) { | |
// get connectionId of patient and send offer |
Promises give you hope of your wishes being granted somewhere in the future. Everyone has been promised by someone at some point in their life, and that's a sure thing. The only problem is promises aren't always fulfilled.
We make promises when we claim to do something in the future and javascript promises are the same. Promises always result in fulfillment or rejection. Enough talk, lets begin coding.
let mommysPromise = new Promise((resolve, reject)=>{
setTimeout(()=>resolve("Buys a birthday present!"), 2000)
Please go through the post of bind before proceeding, this article will make much more sense. The difference between bind and apply is apply doesnot return a new function, it instantly calls the function that is being bounded to the object.
Here is the object we will be using for demonstrating the use of apply
var object = {
firstName: "pika",
lastName: "chu",
let pokemonBall = function() {
console.log(this.name, this.powers)
}
pokemonBall()
What will be the output of the above function. undefined!
But what if we had a pokemon, with a real name and powers!. So lets go ahead and catch a pokemon. But how do we do that?