kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
58 lines (57 loc) • 9.96 kB
JavaScript
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',
temperature: 1.0,
topP: 0.8
};
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"])({}, _actions.UPDATE_AI_ASSISTANT_CONFIG, updateAiAssistantConfigHandler), _actions.UPDATE_AI_ASSISTANT_MESSAGES, updateAiAssistantMessagesHandler), _actions.SET_START_SCREEN_CAPTURE, setStartScreenCaptureHandler), _actions.SET_SCREEN_CAPTURED, setScreenCapturedHandler), 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
})
});
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVkdXhBY3Rpb25zIiwicmVxdWlyZSIsIl9hY3Rpb25zIiwib3duS2V5cyIsImUiLCJyIiwidCIsIk9iamVjdCIsImtleXMiLCJnZXRPd25Qcm9wZXJ0eVN5bWJvbHMiLCJvIiwiZmlsdGVyIiwiZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yIiwiZW51bWVyYWJsZSIsInB1c2giLCJhcHBseSIsIl9vYmplY3RTcHJlYWQiLCJhcmd1bWVudHMiLCJsZW5ndGgiLCJmb3JFYWNoIiwiX2RlZmluZVByb3BlcnR5MiIsImdldE93blByb3BlcnR5RGVzY3JpcHRvcnMiLCJkZWZpbmVQcm9wZXJ0aWVzIiwiZGVmaW5lUHJvcGVydHkiLCJpbml0aWFsQ29uZmlnIiwiaXNSZWFkeSIsInByb3ZpZGVyIiwibW9kZWwiLCJhcGlLZXkiLCJiYXNlVXJsIiwidGVtcGVyYXR1cmUiLCJ0b3BQIiwiaW5pdGlhbFN0YXRlIiwiY29uZmlnIiwibWVzc2FnZXMiLCJzY3JlZW5zaG90VG9Bc2siLCJzdGFydFNjcmVlbkNhcHR1cmUiLCJzY3JlZW5DYXB0dXJlZCIsImFpQXNzaXN0YW50UmVkdWNlciIsImV4cG9ydHMiLCJoYW5kbGVBY3Rpb25zIiw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