UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

65 lines (64 loc) 11.3 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.aiAssistantReducer = void 0; var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _reduxActions = require("redux-actions"); var _actions = require("../actions"); function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // SPDX-License-Identifier: MIT // Copyright contributors to the kepler.gl project // Initial state for the reducer var initialConfig = { isReady: false, provider: 'openai', model: 'gpt-4o', apiKey: '', baseUrl: 'http://localhost:11434/api', temperature: 0.0, topP: 1.0 }; var initialState = { config: initialConfig, messages: [], screenshotToAsk: { startScreenCapture: false, screenCaptured: '' } }; var aiAssistantReducer = exports.aiAssistantReducer = (0, _reduxActions.handleActions)((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _actions.UPDATE_AI_ASSISTANT_CONFIG, updateAiAssistantConfigHandler), _actions.UPDATE_AI_ASSISTANT_MESSAGES, updateAiAssistantMessagesHandler), _actions.SET_START_SCREEN_CAPTURE, setStartScreenCaptureHandler), _actions.SET_SCREEN_CAPTURED, setScreenCapturedHandler), _actions.SET_MAP_BOUNDARY, setMapBoundaryHandler), initialState); function updateAiAssistantConfigHandler(state, action) { return _objectSpread(_objectSpread({}, state), {}, { config: _objectSpread(_objectSpread({}, state.config), action.payload) }); } function updateAiAssistantMessagesHandler(state, action) { return _objectSpread(_objectSpread({}, state), {}, { messages: action.payload }); } function setStartScreenCaptureHandler(state, action) { return _objectSpread(_objectSpread({}, state), {}, { screenshotToAsk: { startScreenCapture: action.payload, screenCaptured: '' } }); } function setScreenCapturedHandler(state, action) { return _objectSpread(_objectSpread({}, state), {}, { screenshotToAsk: _objectSpread(_objectSpread({}, state.screenshotToAsk), {}, { screenCaptured: action.payload }) }); } function setMapBoundaryHandler(state, action) { return _objectSpread(_objectSpread({}, state), {}, { keplerGl: _objectSpread(_objectSpread({}, state.keplerGl), {}, { mapBoundary: action.payload }) }); } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVkdXhBY3Rpb25zIiwicmVxdWlyZSIsIl9hY3Rpb25zIiwib3duS2V5cyIsImUiLCJyIiwidCIsIk9iamVjdCIsImtleXMiLCJnZXRPd25Qcm9wZXJ0eVN5bWJvbHMiLCJvIiwiZmlsdGVyIiwiZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yIiwiZW51bWVyYWJsZSIsInB1c2giLCJhcHBseSIsIl9vYmplY3RTcHJlYWQiLCJhcmd1bWVudHMiLCJsZW5ndGgiLCJmb3JFYWNoIiwiX2RlZmluZVByb3BlcnR5MiIsImdldE93blByb3BlcnR5RGVzY3JpcHRvcnMiLCJkZWZpbmVQcm9wZXJ0aWVzIiwiZGVmaW5lUHJvcGVydHkiLCJpbml0aWFsQ29uZmlnIiwiaXNSZWFkeSIsInByb3ZpZGVyIiwibW9kZWwiLCJhcGlLZXkiLCJiYXNlVXJsIiwidGVtcGVyYXR1cmUiLCJ0b3BQIiwiaW5pdGlhbFN0YXRlIiwiY29uZmlnIiwibWVzc2FnZXMiLCJzY3JlZW5zaG90VG9Bc2siLCJzdGFydFN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