Code Monkey home page Code Monkey logo

r-spacex-ai-bot's Introduction

Dialogflow <----> r/SpaceX-API Webhook.

Build Status GitHub release

This is a webhook/google cloud function implementation that will receive queries from Dialogflow and requests information from the r/SpaceX API

Dialogflow Agent

Please see the readme in the Dialogflow Agent folder for more information. The Dialogflow Agent folder is not needed for deployment of the webhook, I am just keeping it in the repo for ease of use.

DEMO: Feel free to try the agent, go here and start the conversation with a simple 'Hello'.

Development DEMO: For the Dev version of the bot here tes change

r-spacex-ai-bot's People

Contributors

harvsg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

famalamboidem

r-spacex-ai-bot's Issues

Many vehicle info responses cause crashes due to inconsistent API data structure between vehicles.

See commented-out lines:

r-SpaceX-AI-Bot/index.js

Lines 62 to 76 in 73fbfde

// vehicle data structure is inconsistant and that breaks this https://github.com/r-spacex/SpaceX-API/issues/53
//"size": `The ${data.name} is ${data.height.meters} meters tall and ${data.diameter.meters} meters in diameter. It has a dry mass of ${data.mass.kg} kilograms. `,
"leo_weight": `The ${data.name} can launch ${data.payload_weights[0].kg} kilograms to ${data.payload_weights[0].name}`,
//engine data structure in the API differs over different vehicles. https://github.com/r-spacex/SpaceX-API/issues/53
//"gto_weight": `The ${data.name} can launch ${data.payload_weights[1].kg} kilograms to ${data.payload_weights[1].name}`,
//"mars_weight": `The ${data.name} can launch ${data.payload_weights[2].kg} kilograms to ${data.payload_weights[2].name}`,
"first_stage_reusable": `The ${data.name} is ${data.first_stage.reusable? "":"not "}a reusable rocket`,
//"engines":`The first stage has ${data.first_stage.engines.number} ${data.engines.type} ${data.engines.version}s. The second stage has ${data.second_stage.engines.number} ${data.second_stage.engines.type}s. `,
//"engine_stats":`The first stage's ${data.engines.number} ${data.first_stage.engines.type}s can burn for ${data.first_stage.burn_time_sec} with a sea level thrust of ${data.first_stage.engines.thrust_sea_level} and a vacuum thrust of ${data.first_stage.engines.thrust_vacuum}. The second stage's ${data.second_stage.engines.number} ${data.second_stage.engines.type}s can burn for ${data.second_stage.burn_time_sec} with a sea level thrust of ${data.second_stage.engines.thrust_sea_level} and a vacuum thrust of ${data.second_stage.engines.thrust_vacuum}. `,
//"fuel":`The first satge on the ${data.name} carries ${data.first_stage.fuel_amount_tons} tons of ${data.first_stage.engines.propellant_1} and ${data.first_stage.engines.propellant_2}, The second satge on the carries ${data.second_stage.fuel_amount_tons} tons of ${data.second_stage.engines.propellant_1} and ${data.second_stage.engines.propellant_2}. `,
"second_stage_payload_options":`${data.second_stage.payloads.option_1} and ${data.second_stage.payloads.option_2}`,
"fairing_size":` The fairing is ${data.second_stage.payloads.composite_fairing.height.meters} meters tall and ${data.second_stage.payloads.composite_fairing.diameter.meters} meters in diameter. `,
//"engine_loss_max":`${data.engines.engine_loss_max} can be lost during flight without causing mission failure`,
//"landing_legs":`The ${data.name} has ${data.landing_legs.number} landing legs which are made from ${data.landing_legs.material}`,
//

Related to issue r-spacex/SpaceX-API#53.

Could use various if statements to handle it, but would only be a temporary fix as it is in the pipeline to be done on the API end. Best to wait until data-structure is near-final.

CI is broken

Travis build is triggered and builds fine

However the google source repo does not update to the latest commit from the github repo, so what builds is an old build

The CI does not test the function before or after deploying

deploy:
  - provider: script
    script:
      # change FUNCTION_NAME PROJECT and REPO to the values from the cloud console: https://console.cloud.google.com/code/develop. Note function name is from your main file, usualy index.js, the main function exports.FUNCTION_NAME
      - gcloud --quiet beta functions deploy SpaceXFulfillment --source-url https://source.developers.google.com/p/r-spacex-ai/r/r-SpaceX-AI-google-source-repo --source-path / --trigger-http
      #- gcloud beta functions call SpaceXFulfillment --file=requestExample.json # NOT working, it would be good to emulate and test the function and then only deploy if successful!
   

functions call SpaceXFulfillment --file=requestExample.json
should, in theory, test the function, it would be great to make deployment conditional on the outcome of that.

Edit: --file is not a valid flag

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.