feat: added featured measure register

pull/1/head
Artem-Darius Weber 1 year ago
parent c30617a9cf
commit 7b8546fff0

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="fa9b3ab0-bfd5-4e07-8e87-da3d901a4d2e" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/weather_platform/apps/agw/src/measures/measures.controller.ts" beforeDir="false" afterPath="$PROJECT_DIR$/weather_platform/apps/agw/src/measures/measures.controller.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/weather_platform/apps/py-tg-bot-weather-agent/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/weather_platform/apps/py-tg-bot-weather-agent/main.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="1" id="Add" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"node.js.selected.package.tslint": "(autodetect)",
"ts.external.directory.path": "/Users/darius/Desktop/ASC/CyberGarden/kempt-kinkajou/weather_platform/node_modules/typescript/lib"
}
}]]></component>
<component name="TaskManager">
<servers />
</component>
</project>

@ -1,4 +1,4 @@
import {Body, Controller, Get, Post} from "@nestjs/common"; import {Body, Controller, Get, Param, Post} from "@nestjs/common";
import { MeasureCreateDTOLocalClass, MeasuresService } from "./measures.service"; import { MeasureCreateDTOLocalClass, MeasuresService } from "./measures.service";
import { import {
ApiInternalServerErrorResponse, ApiInternalServerErrorResponse,
@ -66,6 +66,33 @@ export class MeasuresController {
} }
@ApiOperation({ summary: 'Register Measure', description: 'Create Measure using ASC_WEATHER_RGM', operationId: 'create', tags: ['Measures StorePackages'], })
@ApiResponse({ status: 200, type: MeasuresCreateSuccessResponse, description: 'The found measures', })
@Get('register/:sendedInDate/:sensor_uuid/:agregator_uuid/:math_time/:msg_type/:msg_value')
async createMeasuresPackBody(
@Param('sendedInDate') sendedInDate: string,
@Param('sensor_uuid') sensor_uuid: string,
@Param('agregator_uuid') agregator_uuid: string,
@Param('math_time') math_time: string,
@Param('msg_type') msg_type: string,
@Param('msg_value') msg_value: string,
): Promise<Partial<MeasuresCreateSuccessResponse> | null> {
const measure_create_data: MeasureCreateDTOLocalClass = {
sendedInDate: sendedInDate,
sensor_uuid: sensor_uuid,
agregator_uuid: agregator_uuid,
time: math_time,
type: msg_type,
value: msg_value,
}
const res = await this.measuresService.create(measure_create_data);
return res ? { code: '200' } : { code: '500' };
}
@ApiOperation({ @ApiOperation({
summary: 'Get measures data with Prisma params', tags: ['Measures'], description: 'Get measures with Prisma params', operationId: 'getWithParams', summary: 'Get measures data with Prisma params', tags: ['Measures'], description: 'Get measures with Prisma params', operationId: 'getWithParams',

@ -10,9 +10,15 @@ import requests
import telebot import telebot
from langchain.agents import create_json_agent, AgentExecutor from langchain.agents import create_json_agent, AgentExecutor
from langchain.agents.agent_toolkits import JsonToolkit from langchain.agents.agent_toolkits import JsonToolkit
import os
# OPENAI_API = "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" OPENAI_API = "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"
OPENAI_API = "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"
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com"
os.environ["LANGCHAIN_API_KEY"] = "ls__f7252ae2e7e4433d965ad37d94d63d6d"
project_name = "k-lab-weather"
os.environ["LANGCHAIN_PROJECT"] = "project_name"
BOT_KEY = '6415742729:AAHVyDkHHF57ZsVd9gJjVtXjKE2M9CydzPk' BOT_KEY = '6415742729:AAHVyDkHHF57ZsVd9gJjVtXjKE2M9CydzPk'
@ -21,10 +27,10 @@ WELCOME_MSG = """"
Спроси что-нибудь у нашего бота 🙂 Спроси что-нибудь у нашего бота 🙂
""" """
# Weather AGW # AGW_PORT = 8045
AGW_PORT = 8045 # AGW_HOST = 'localhost'
AGW_HOST = 'localhost' # AGW_URL = f"http://{AGW_HOST}:{AGW_PORT}/"
AGW_URL = f"http://{AGW_HOST}:{AGW_PORT}/" AGW_URL = f"https://gw.cg.k-lab.su/"
bot = telebot.TeleBot(BOT_KEY) bot = telebot.TeleBot(BOT_KEY)
@ -111,7 +117,8 @@ agent_chain = initialize_agent(
max_iterations=4, max_iterations=4,
agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION, agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
verbose=True, verbose=True,
output_parser=output_parser output_parser=output_parser,
project_name=project_name
) )
# print(get_weather_data_history_insight()) # print(get_weather_data_history_insight())

Loading…
Cancel
Save