Dify-based water conservancy flood prevention emergency agent development method and equipment
By building workflows and default session flows for water conservancy and flood control emergency business scenarios on the Dify platform, the problems of difficult data fusion and low emergency response efficiency in the existing system were solved, intelligent automatic processing of emergency tasks was achieved, and emergency response efficiency was improved.
Patent Information
- Application Number
- CN202510932129.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-07
- Publication Date
- 2025-10-03
AI Technical Summary
The existing water conservancy and flood control system has difficulty achieving deep integration and collaborative analysis of multiple data, resulting in the need for manual and repeated configuration of emergency tasks, low emergency response efficiency, and the inability to automatically identify user intent and associate corresponding business modules.
Based on the Dify platform, a workflow for water conservancy and flood prevention emergency business scenarios for single-round tasks is built. The workflow nodes are orchestrated through intelligent agent logic. Combined with the default conversation flow of the question classifier node, it can automatically identify user intentions and associate workflows with corresponding business scenarios.
It enables dynamic construction of workflows across businesses, reduces manual repetitive configuration of emergency tasks, improves emergency response efficiency, and eliminates the need for manual process switching when handling complex disaster situations.
Smart Images

Figure CN120743262A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of water conservancy and flood prevention technology, and specifically to a development method and equipment for a water conservancy and flood prevention emergency intelligent body based on Dify. Background Art
[0002] In the field of water conservancy and flood prevention, disaster handling is highly dependent on standardized business processes. The flexibility and intelligence of the workflow directly determine the efficiency of emergency response. Existing flood prevention systems usually implement the above processes through preset scripts or manual scheduling. However, existing technologies rely on a distributed architecture to process meteorological, hydrological, geographical and other data sources, making it difficult to achieve deep integration and collaborative analysis of multiple data, and difficult to dynamically build workflows across businesses. This results in emergency tasks requiring manual reconfiguration and low response efficiency. At the same time, complex disaster handling relies on multiple rounds of dialogue interaction, but existing flood prevention systems cannot automatically identify user intent and associate corresponding business modules. If the handling process is manually switched, it will further affect the efficiency of emergency response. Summary of the Invention
[0003] To address the above issues, this application proposes a method for developing a water conservancy flood control emergency agent based on Dify, including: In response to the triggering operation of the orchestration workflow for single-round tasks in Dify, the workflow corresponding to each water conservancy flood prevention emergency business scenario is constructed; According to the business execution logic of the intelligent agent, each workflow node is added in sequence to the workflow to realize the business process arrangement of the workflow corresponding to each water conservancy and flood prevention emergency business scenario; In response to a triggering operation on the complex multi-round dialogue workflow in Dify, a default conversation flow corresponding to the water conservancy and flood prevention emergency service is constructed; wherein the default conversation flow includes a start node, an LLM node, and a direct reply node; Add a problem classifier node to the default conversation flow, select the workflow corresponding to each of the water conservancy and flood prevention emergency business scenarios linked under the problem classifier node, add the workflow to the default conversation flow, and obtain the intelligent agent corresponding to each of the water conservancy and flood prevention emergency business scenarios.
[0004] In one implementation of the present application, according to the business execution logic of the intelligent agent, each workflow node is sequentially added to the workflow to implement the business process arrangement of the workflow corresponding to each of the water conservancy and flood control emergency business scenarios, specifically including: According to the business execution logic of the agent, a parameter extractor node, a code execution node, an LLM node and an end node are sequentially added to the workflow; Through the parameter extractor node, the code execution node, the LLM node and the end node, the business process orchestration of the workflow corresponding to each water conservancy and flood prevention emergency business scenario is realized.
[0005] In one implementation of the present application, the business process orchestration of the workflow corresponding to each of the water conservancy and flood control emergency business scenarios is implemented through the parameter extractor node, the code execution node, the LLM node, and the end node, specifically including: Based on the parameter extractor node, obtain key information in the question initiated by the user; Based on the code execution node, the key information is used as an input parameter, a water conservancy and flood prevention emergency business scenario is determined according to the key information, corresponding water conservancy station data is obtained, and business analysis logic corresponding to the water conservancy and flood prevention emergency business scenario is determined; Based on the LLM node, the business analysis logic is inferred through a preset large model to output corresponding water conservancy and flood control emergency data; Based on the end node, the water conservancy and flood prevention emergency data is used as an output parameter to implement the business process arrangement of the workflow corresponding to each water conservancy and flood prevention emergency business scenario.
[0006] In one implementation of the present application, the water conservancy and flood control emergency business scenarios include rainfall analysis, water situation analysis, rainfall forecast, water situation forecast, disaster forecast, briefing generation, emergency response assistant, plan execution, hazard handling, and material dispatch.
[0007] In one implementation of the present application, obtaining the water conservancy station data corresponding to the water conservancy and flood prevention emergency business scenario and determining the business analysis logic corresponding to the water conservancy and flood prevention emergency business scenario specifically include: Acquire water conservancy station data corresponding to the water conservancy flood prevention emergency business scenario, and process the water conservancy station data to obtain processed water conservancy station data; When the water conservancy and flood prevention emergency business scenario is rainfall analysis, the accumulated rainfall in a preset period is calculated based on the processed water conservancy station data, and a rainfall warning of a corresponding warning level is triggered based on the accumulated rainfall; When the water conservancy and flood prevention emergency business scenario is water condition analysis, special water conservancy stations with special water conditions are screened out from the water conservancy stations based on the processed water conservancy station data, as well as water condition information corresponding to the special water conservancy stations; When the water conservancy and flood prevention emergency business scenario is rainfall forecast, the average rainfall of the watershed is calculated based on the processed water conservancy station data, and the location of the center of the rainstorm is determined based on the average rainfall; In the case where the water conservancy and flood control emergency business scenario is a water situation forecast, calling a runoff generation and convergence model, determining a runoff generation and convergence call result corresponding to each water conservancy station based on the processed water conservancy station data, determining a historical peak flow corresponding to the water conservancy station based on the runoff generation and convergence call result, and uploading the historical peak flow to a flood control knowledge base; When the water conservancy and flood prevention emergency business scenario is disaster forecasting, determining the rainfall threshold, typhoon path, flood water level and address disaster risk distribution information based on the processed water conservancy station data; In the case where the water conservancy and flood prevention emergency business scenario is briefing generation, generating water and rainfall briefings corresponding to different report types based on the processed water conservancy station data; In the case where the water conservancy and flood prevention emergency business scenario is an emergency response assistant, a corresponding emergency response plan is selected from a preset plan knowledge base based on the processed water conservancy station data; In the case where the water conservancy flood prevention emergency business scenario is plan execution, generating an emergency response plan based on the processed water conservancy station data, and constructing the plan knowledge base based on the emergency response plan; When the water conservancy and flood prevention emergency business scenario is a dangerous situation handling, obtaining a dangerous situation handling technical specification document, building a dangerous situation knowledge base based on key information in the dangerous situation handling specification document, and obtaining a corresponding dangerous situation handling plan from the dangerous situation knowledge base based on the processed water conservancy station data; When the water conservancy and flood prevention emergency business scenario is material dispatch processing, a target emergency warehouse is selected according to the disaster information, and a dispatch plan corresponding to the target emergency warehouse is generated.
[0008] In one implementation of the present application, after uploading the historical highest flood peak flow to the flood control knowledge base, the method further includes: According to the historical highest flood peak flow, the warning level corresponding to each water conservancy monitoring station is determined, and according to the warning level, the response measures corresponding to the warning level are retrieved from the flood control knowledge base.
[0009] In one implementation of the present application, selecting a target emergency warehouse based on disaster information specifically includes: Determine the types of supplies needed for the disaster based on the disaster information; According to the type of supplies, emergency warehouses that can provide supplies are screened, and according to the distance between the emergency warehouse and the disaster location, the emergency warehouse with the closest corresponding distance is selected as the target emergency warehouse.
[0010] The present application provides a device for developing a water conservancy and flood control emergency agent based on Dify, the device comprising: The workflow construction module is used to respond to the triggering operation of the orchestration workflow for single-round tasks in Dify and build workflows corresponding to various water conservancy and flood prevention emergency business scenarios; An orchestration module, configured to sequentially add workflow nodes to the workflow according to the business execution logic of the agent, so as to implement business process orchestration of the workflow corresponding to each of the water conservancy and flood prevention emergency business scenarios; A default conversation flow construction module is used to construct a default conversation flow corresponding to the water conservancy and flood prevention emergency business in response to a triggering operation on the complex multi-round conversation workflow in Dify; wherein the default conversation flow includes a start node, an LLM node, and a direct reply node; An intelligent agent construction module is used to add a problem classifier node to the default conversation flow, select the workflow corresponding to each of the water conservancy and flood prevention emergency business scenarios linked under the problem classifier node, add the workflow to the default conversation flow, and obtain the intelligent agent corresponding to each of the water conservancy and flood prevention emergency business scenarios.
[0011] The present application provides a device for developing a water conservancy and flood control emergency agent based on Dify, the device comprising: at least one processor; and, a memory communicatively coupled to the at least one processor; In which, the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the Dify-based water conservancy and flood control emergency intelligent body development method as described in any of the above items.
[0012] An embodiment of the present application provides a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to: A method for developing a water conservancy and flood control emergency intelligent agent based on Dify as described in any of the above items.
[0013] The development method of the Dify-based water conservancy flood control emergency intelligent agent proposed in this application can bring the following beneficial effects: By building a workflow for water conservancy and flood prevention emergency business scenarios for single-round tasks in Dify and arranging workflow nodes according to the logic of the intelligent agent, it is possible to dynamically build workflows across businesses and reduce the manual repetitive configuration of emergency tasks; at the same time, by building an intelligent agent with the help of the default session flow containing the problem classifier node, there is no need to manually switch processes when dealing with complex disasters. Instead, it can automatically identify user intentions and associate workflows for corresponding business scenarios, and perform business processing through the workflow configured in each water conservancy and flood prevention emergency business scenario, thereby improving emergency response efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 A flowchart of a method for developing a water conservancy and flood control emergency agent based on Dify provided in an embodiment of the present application; Figure 2 A workflow arrangement diagram provided in an embodiment of the present application; Figure 3 A schematic diagram of a default conversation flow provided in an embodiment of the present application; Figure 4 A schematic diagram of a default session flow arrangement provided in an embodiment of the present application; Figure 5 A schematic diagram of the structure of a development device for a water conservancy and flood control emergency intelligent agent based on Dify provided in an embodiment of the present application; Figure 6 A structural diagram of the development equipment of the water conservancy and flood control emergency intelligent body based on Dify provided in an embodiment of the present application. DETAILED DESCRIPTION
[0015] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0016] Dify is an open-source, large-scale language model application development platform. Its core goal is to lower the barrier to entry for AI application development, supporting full-process management from prototyping to production deployment, enabling developers to quickly build production-grade generative AI applications. Developers can define application prompts, context, and various plug-ins through simple drag-and-drop configuration.
[0017] Dify uses natural language processing technology to rapidly respond to user inquiries, supporting contextual memory and multi-turn dialogue design. It can also automatically generate articles, summaries, and code, or parse long documents for structured extraction (e.g., invoice recognition and contract analysis). Furthermore, it can integrate with enterprise databases to generate data reports and provide decision-making recommendations, for example, by converting natural language queries into database commands using NL2SQL.
[0018] Dify supports the integration of mainstream LLM models (such as DeepSeek, OpenAI, Anthropic, ChatGLM, Tongyi Qianwen, etc.) and auxiliary models such as Embedding and Rerank, and allows the integration of custom models. Dify has built-in the key technology stack required to build LLM applications, including support for hundreds of models, an intuitive Prompt orchestration interface, a high-quality RAG engine, a robust Agent framework, flexible process orchestration, and a set of easy-to-use interfaces and APIs. Through Dify's low-code capabilities, a data middleware can be quickly built to connect to multi-source data such as satellite cloud images, hydrological sensors, and drone inspections. By choreographing workflows for different water conservancy and flood control emergency business scenarios, an intelligent agent capable of handling complex disasters is formed. The intelligent agent automatically analyzes the current flood control intentions and provides intelligent emergency plans corresponding to the current water conservancy and flood control emergency business scenario without manually switching processing processes, thereby improving disaster response efficiency.
[0019] The following describes in detail the technical solutions provided by various embodiments of the present application in conjunction with the accompanying drawings.
[0020] like Figure 1 As shown, the development method of the water conservancy and flood control emergency intelligent agent based on Dify provided in the embodiment of the present application includes: S101: In response to a triggering operation on the orchestration workflow for a single-round task in Dify, a workflow corresponding to each water conservancy and flood prevention emergency business scenario is constructed.
[0021] like Figure 2 The following diagram shows a workflow orchestration diagram. Create a blank application in Dify, select Workflow (a workflow orchestrated for single-round automated tasks), and enter an application name, such as Rainfall Analysis, Water Regime Analysis, or Rainfall Forecast. Clicking OK will take you to the Agent Orchestration page, where you can begin orchestrating business processes such as Rainfall Analysis and Water Regime Analysis. A default workflow with a Start node is generated on the Agent Orchestration page. The server will respond to triggering actions on the orchestrated workflow in Dify for single-round tasks by constructing workflows corresponding to various water conservancy and flood control emergency scenarios.
[0022] S102: According to the business execution logic of the intelligent body, each workflow node is added to the workflow in sequence to realize the business process arrangement of the workflow corresponding to each water conservancy and flood prevention emergency business scenario.
[0023] The workflow orchestration interface contains multiple workflow nodes. When orchestrating the workflow, it is necessary to follow the business execution logic of the intelligent body and select appropriate workflow nodes from the multiple workflow nodes provided in the interface and add them to the workflow, thereby realizing the business process orchestration of the workflow corresponding to each water conservancy flood control emergency business scenario.
[0024] Water conservancy and flood emergency scenarios include rainfall analysis, water situation analysis, rainfall forecast, water situation forecast, disaster forecast, briefing report generation, emergency response assistance, plan execution, hazard management, and material dispatch. The workflow processes for different water conservancy and flood emergency scenarios are largely the same, involving parameter extraction, code execution, model inference, and parameter output.
[0025] Therefore, when choreographing a workflow, it's necessary to sequentially add parameter extractor nodes, code execution nodes, LLM nodes, and end nodes to the workflow according to the agent's business execution logic. These nodes, along with the code execution nodes, LLM nodes, and end nodes, can then be used to orchestrate the workflows corresponding to each water conservancy and flood emergency business scenario.
[0026] Specifically, the parameter extractor node retrieves key information from the user's question. Key information can include date, monitoring location, and monitoring content. For example, if a user asks, "Get rainfall information for region A over the past week," "region A," "past week," and "rainfall information" are all key information. The code execution node uses this key information as input parameters and uses Python code to initiate an API request or database connection to retrieve water station data. The raw data is received and processed (cleaning abnormal data, converting time formats, etc.), and the results are output in JSON format. Furthermore, the water conservancy and flood control emergency business scenario is determined based on this key information. For example, if the key information contains "rainfall information," the corresponding water conservancy and flood control emergency business scenario is determined to be a rainfall analysis scenario. After determining the specific business scenario, the corresponding water conservancy and flood control emergency business scenario is retrieved, and the corresponding business analysis logic is determined. This business analysis logic only indicates the business execution process and does not directly lead to specific business execution results. These business execution results require further reasoning through LLM nodes. Therefore, after determining the business analysis logic, it is necessary to infer the business analysis logic using a preset large model based on the LLM node to output the corresponding water conservancy and flood control emergency data. After outputting the water conservancy and flood control emergency data corresponding to the current water conservancy and flood control emergency business scenario, based on the end node, using the water conservancy and flood control emergency data as an output parameter, the business process orchestration of the workflow corresponding to each water conservancy and flood control emergency business scenario can be implemented.
[0027] In one embodiment, each water conservancy and flood prevention emergency business scenario needs to complete its corresponding business process orchestration based on the above workflow orchestration process.
[0028] Specifically, the water conservancy station data corresponding to the water conservancy flood prevention emergency business scenario is obtained and processed to obtain the processed water conservancy station data. Water conservancy station data includes various types of data, and the water conservancy station data collected in different water conservancy flood prevention emergency business scenarios will also be different.
[0029] In the case of rainfall analysis in a water conservancy and flood control emergency scenario, rainfall monitoring data from monitoring stations / points must be processed to implement short-term rainstorm statistics, rainfall warnings, and the analysis results presented in graphical and textual form. Therefore, based on the processed water conservancy station data, the cumulative rainfall over a preset period is calculated and, based on this cumulative rainfall, a rainfall warning of the corresponding warning level is triggered. The water conservancy station data here refers to rainfall data.
[0030] Specifically, Python code is used to initiate API requests or database connections to obtain the latest rainfall data from all water conservancy stations. The system then receives and processes raw rainfall monitoring data (cleaning out anomalies, converting time formats, and filtering data from stations without rainfall). The data is then output in JSON format, containing fields such as the station ID, timestamp, and rainfall amount. Business analysis logic is written in Python to conduct short-term rainstorm statistics and early warning analysis. Short-term rainstorm statistics include calculating 1-hour, 3-hour, and 6-hour sliding cumulative rainfall to identify short-term heavy rainfall events; analyzing rainstorm characteristics, including duration, intensity, and spatial distribution; and calculating rainstorm frequency and identifying extreme rainfall events. Rainfall warnings include triggering different levels of warnings based on preset thresholds: blue warning: rainfall ≥30 mm in one hour; yellow warning: rainfall ≥50 mm in one hour; orange warning: rainfall ≥80 mm in one hour; and red warning: rainfall ≥100 mm in one hour. Finally, generate charts and text reports, add visualization components or execute Python code, draw echarts charts, such as real-time rainfall line charts, regional rainfall heat maps, and rainstorm statistics bar charts, and generate templated text reports that include a summary of the current rainfall situation, a description of the rainstorm event, and warning recommended measures.
[0031] In the case of water condition analysis in a flood control emergency scenario, it is necessary to intelligently retrieve special water conditions based on water monitoring data and present the analysis results in table and text form. Based on the processed water station data, special water stations with special water conditions are screened out, along with the corresponding water condition information.
[0032] Specifically, Python code is used to initiate API requests or database connections to obtain water level data, basic station information, and basic river information from all stations. Raw water level monitoring data is received and processed, and the data is output in JSON format. Python code is used to write business analysis logic. The specific business analysis logic is as follows: determine the judgment rules for special water conditions, and based on the judgment rules, filter out data that meets the special water conditions. Special water conditions include exceeding the warning level or exceeding the guaranteed water level, and reservoirs exceeding the flood limit or exceeding the flood control high water level. After determining whether a special water condition exists at a water conservancy station, the water condition information corresponding to the special water conservancy station is determined, that is, the time when the water level exceeds or falls below the characteristic water level. Finally, all special water conservancy stations are listed in a table, and the distribution and characteristics of the special water conditions are analyzed and summarized.
[0033] In the case of rainfall forecasting for water conservancy and flood control emergency operations, gridded rainfall forecast data is used to intelligently search for rainfall conditions along the route for the next 24, 48, and 72 hours. This data identifies the average rainfall within each watershed and the location of the center of the rainstorm, providing guidance on which areas and watersheds require attention. The analysis results are presented in the form of lists, forecast maps, and text. Therefore, it is necessary to calculate the average rainfall across the watershed based on processed water conservancy station data and determine the location of the center of the rainstorm based on the average rainfall.
[0034] Specifically, the system extracts the future rainfall description from the user's question and uses this future rainfall as an input parameter for the API request. Based on these parameters, Python code is used to dynamically request the API to obtain gridded rainfall forecast data for the next 24 hours, 48 hours, or 72 hours. The system then receives and processes the raw gridded rainfall forecast data and outputs it in JSON format.
[0035] Use Python code to write business analysis logic to calculate the area average rainfall and the location of the rainstorm center based on gridded rainfall forecast data. Specifically, the Thiessen polygon method is used to calculate the area rainfall in the watershed. Hourly statistics are collected for the area average rainfall, cumulative area average rainfall, and maximum period area average rainfall. The hourly average rainfall is calculated by summing the rainfall data for all rainfall points and dividing it by the number of rainfall points. The hourly maximum rainfall is determined by the maximum rainfall value across all rainfall points in the current hour. The longitude and latitude of the hourly maximum rainfall point, as well as the place name, are also determined. The cumulative average rainfall (summing each rainfall point over several hours as a single point and averaging the cumulative data for each rainfall point), the cumulative maximum rainfall (summing each rainfall point over several hours as a single point and averaging the cumulative data for each rainfall point), and the longitude and latitude of the cumulative maximum rainfall point, as well as the place name, are also determined. Based on this information, the rainfall attributes of the rainstorm center are determined, namely, the center location, maximum rainfall intensity, and duration. Based on the rainfall attributes at the center of the rainstorm, the corresponding rainfall level is determined, and ultimately a chart and text report are generated. The charts include spatial distribution maps, specifically rainfall contour maps, rainstorm center markers, and risk area highlights; and temporal change maps, specifically including a time series curve of average rainfall, a histogram of accumulated rainfall, and the movement path of the rainstorm center. The text analysis report should include a rainfall overview, key watershed analysis, rainstorm center characteristics, risk warnings and recommendations, extreme value statistics, spatiotemporal variation characteristics, historical comparisons, and disaster risk.
[0036] In the case of water situation forecasting in the water conservancy and flood emergency response scenario, it is necessary to simulate the flood peak process based on the results of the runoff generation and confluence model. Simultaneously, the flood control knowledge base is integrated to display stations that may have water situation alerts in the near future, and the analysis results are presented in charts and text. The runoff generation and confluence model is called, and based on the processed water conservancy station data, the runoff generation and confluence call results corresponding to each water conservancy station are determined. Based on the runoff generation and confluence call results, the historical peak flow rate corresponding to the water conservancy station is determined and uploaded to the flood control knowledge base.
[0037] Specifically, Python code is used to initiate dynamic API requests to obtain gridded rainfall forecast data for the next 24 / 48 / 72 hours, receive and process the raw gridded rainfall forecast data, and output the data in JSON format. Python code is also used to initiate API requests to obtain basic station information data, receive and process the raw station information data, and output the data in JSON format.
[0038] Using Python code to write business analysis logic, the accumulated rainfall and rainfall duration at each station are determined based on gridded rainfall forecast data and the latitude and longitude of each station. The runoff generation and confluence model is then called sequentially to output the runoff generation and confluence results for each station. These results include the confluence area, forecast duration, peak flow, peak occurrence time, total rainfall, peak duration, total flood volume, and runoff coefficient. Based on these runoff generation and confluence results, the historical peak flow corresponding to each water conservancy station is determined and uploaded to the knowledge base. For example, at measuring point A, the historical peak flow reached 650 cubic meters, reaching a Level IV warning.
[0039] After uploading the historical peak flow rates to the flood control knowledge base, a knowledge search is performed to retrieve the historical peak flow rates. Based on the retrieved peak flow rates, water conservancy stations that meet the warning conditions are selected. Response measures corresponding to each warning level are determined. After uploading these response measures to the flood control knowledge base, a secondary knowledge search is performed within the flood control knowledge base. Specifically, based on the warning level of the water conservancy station, the corresponding response measures are retrieved from the flood control knowledge base and the corresponding water situation warning is issued based on these response measures.
[0040] Finally, charts and text reports are generated based on the above information, summarizing the information of water conservancy stations with water risks, flood peak flow, warning level, response measures, etc., drawing a flood peak propagation time series diagram, and summarizing the current water situation overview, warning site list, warning level, expected time to exceed the warning level, possible impact range, and recommended measures to generate a corresponding text report.
[0041] In the case of disaster forecasting in water conservancy and flood emergency response scenarios, disaster warnings are issued based on forecast data for rainfall, floods, typhoons, and geological disaster risk points, with analysis results presented in both graphical and textual form. Therefore, it is necessary to determine rainfall thresholds, typhoon paths, flood levels, and address-based disaster risk distribution information based on processed water conservancy station data.
[0042] Specifically, Python code is used to initiate API requests to obtain rainfall, typhoon forecast data, and flood monitoring data, receiving and processing the raw data and outputting it in JSON format. Python code is also used to develop business analysis logic to determine rainfall thresholds, predict typhoon paths, model flood level predictions, and calculate geological hazard risk indices. Visual charts are then generated to display rainfall heat maps, flood level forecast curves, typhoon path forecasts, and geological hazard risk distribution maps. Warning information is then generated based on the warning level and content.
[0043] In the case of a water conservancy flood control emergency business scenario involving briefing report generation, water and rainfall monitoring and forecast data are used to generate water and rainfall briefing reports, and template-based automatic retrieval generates intelligent briefing reports. Therefore, it is necessary to build a flood control knowledge base based on processed water conservancy station data and create corresponding briefing templates for different report types.
[0044] Specifically, Python code is used to initiate API requests to obtain water level, rainfall, and flow data from all water conservancy stations, as well as meteorological and hydrological forecast data. This raw data is received and processed, and output in JSON format. A report template is selected and, based on this data, a corresponding water and rainfall briefing is generated. This report should include the corresponding indicator values for key water and rainfall indicators, as well as trend analysis for each key indicator.
[0045] In the case of a water conservancy flood emergency scenario, the system automatically matches emergency response plans based on plan activation rules, combined with real-time monitoring, forecast and warning, and manual inspection data, and provides response recommendations. Therefore, it is necessary to select the corresponding emergency response plan from a pre-set plan knowledge base based on the processed water conservancy station data.
[0046] Specifically, Python code is used to initiate API requests to obtain real-time monitoring, forecast and warning, and manual inspection data, receive and process raw data, and output the data in JSON format. By recalling the uploaded emergency plan knowledge base, the system can automatically match emergency response plans from the knowledge base and provide response work recommendations.
[0047] When the water conservancy flood prevention emergency business scenario is the execution of the plan, it is necessary to generate an emergency response plan based on the processed water conservancy station data and build a plan knowledge base based on the emergency response plan.
[0048] Specifically, Python code is used to initiate API requests to obtain real-time water level and flow data from water conservancy stations. The raw data is received and processed, and then output in JSON format. Based on this data, various emergency response plans and activation rules are compiled, including information such as response levels, trigger conditions, handling procedures, and responsible departments. These plans are then documented and structured information is extracted from these documents to build a knowledge base.
[0049] In the case of water conservancy and flood prevention emergency business scenarios for dangerous situation handling, it is necessary to automatically match handling plans for dangerous situations such as landslides, collapses, external flood disasters, freezing, etc.
[0050] Specifically, the system obtains technical specifications for handling hazardous situations, structures them, and extracts key information from them to build a knowledge base for hazardous situations. In the event of a hazardous situation, the system uses processed water conservancy station data to match the corresponding emergency response plan from the knowledge base, enabling a rapid response to the situation.
[0051] In the case of material dispatch in the water conservancy and flood emergency response scenario, the system automatically matches nearby materials and teams based on the actual disaster situation, and provides dispatch recommendations. Therefore, the target emergency warehouse is selected based on the disaster information, and a dispatch plan corresponding to the target emergency warehouse is generated.
[0052] Specifically, based on the disaster information, the required supply type and disaster severity are determined. The disaster severity is used to determine the required supply quantity. Using the supply type and quantity as input parameters, Python code is used to initiate an API request to obtain information about emergency warehouses that can provide the corresponding supply type. Based on the distance between the emergency warehouse and the disaster location, the nearest emergency warehouse is selected as the target emergency warehouse. If the current target emergency warehouse's supply inventory is insufficient to meet the required supply, additional supplies will be dispatched from other nearby emergency warehouses.
[0053] S103: In response to the triggering operation of the complex multi-round dialogue workflow in Dify, a default conversation flow corresponding to the water conservancy and flood prevention emergency business is constructed; wherein the default conversation flow includes a start node, an LLM node, and a direct reply node.
[0054] The above content describes the workflow orchestration process for different water conservancy and flood prevention emergency business scenarios. The Dify platform provided by the embodiment of the present application not only supports workflow orchestration for single-round automated tasks, but also supports orchestration for complex multi-round dialogue workflows. The user creates a blank application based on the Dify platform, selects Chatflow, which is a complex multi-round dialogue workflow, enters the application name, such as water conservancy and flood prevention emergency business, and clicks OK to enter the intelligent body orchestration page to start the overall process orchestration of the water conservancy and flood prevention emergency business. The server will respond to the triggering operation of the complex multi-round dialogue workflow in Dify and build a default conversation flow corresponding to the water conservancy and flood prevention emergency business, such as Figure 3 A schematic diagram of a default conversation flow is shown, where the default conversation flow includes a start node, an LLM node, and a direct reply node.
[0055] S104: Add a problem classifier node to the default conversation flow, select the workflow corresponding to each water conservancy and flood control emergency business scenario linked under the problem classifier node, add the workflow to the default conversation flow, and obtain the intelligent agent corresponding to each water conservancy and flood control emergency business scenario.
[0056] Due to the complex nature of actual flood control business requirements, the default session flow cannot provide refined emergency business logic for each flood control emergency business scenario. Therefore, when building an agent, it is necessary to consider how to accurately match the workflow of the flood control emergency business scenario with the complex flood control business requirements, and then implement the flood control emergency business in this scenario based on the pre-designed workflow.
[0057] Therefore, after obtaining the default session flow, it is necessary to adjust the default session flow to implement specific water conservancy and flood control emergency services. Add a question classifier node after the start node. The question classifier node is integrated into the LLM model with the LLM node. It can understand the questions input by the user and classify them, clarifying the current water conservancy and flood control emergency service scenario. Figure 4 As shown, the question classifier node is linked to workflows corresponding to various water conservancy and flood control emergency business scenarios. These workflows have already completed the orchestration of the corresponding business processes in the previous article. By adding the workflows for each water conservancy and flood control emergency business scenario to the default session flow, that is, the question classifier node, you can obtain intelligent agents corresponding to multiple water conservancy and flood control emergency business scenarios. This intelligent agent includes a start node, a question classifier node, and a direct reply node. After the user asks a question, the question classifier node will classify the user's question and match it with the workflow for the corresponding water conservancy and flood control emergency business scenario. Through the business process corresponding to the workflow, the corresponding water conservancy and flood control emergency business is implemented, and the answer to the question is obtained through the direct output node.
[0058] The above are embodiments of the method proposed in this application. Based on the same idea, some embodiments of this application also provide devices, equipment and non-volatile computer storage media corresponding to the above method.
[0059] Figure 5 This is a schematic diagram of the structure of the development device of the water conservancy flood control emergency intelligent body based on Dify provided in the embodiment of this application. Figure 5 As shown, the device includes: The workflow construction module 501 is used to construct workflows corresponding to various water conservancy and flood prevention emergency business scenarios in response to triggering operations on the orchestration workflows for single-round tasks in Dify; The orchestration module 502 is used to sequentially add workflow nodes to the workflow according to the business execution logic of the agent to implement business process orchestration of workflows corresponding to various water conservancy and flood control emergency business scenarios; The default conversation flow construction module 503 is used to construct a default conversation flow corresponding to the water conservancy and flood prevention emergency business in response to the triggering operation of the complex multi-round dialogue workflow in Dify; wherein the default conversation flow includes a start node, an LLM node, and a direct reply node; The intelligent agent construction module 504 is used to add a problem classifier node to the default conversation flow, select the workflow corresponding to each water conservancy and flood prevention emergency business scenario linked under the problem classifier node, add the workflow to the default conversation flow, and obtain the intelligent agent corresponding to each water conservancy and flood prevention emergency business scenario.
[0060] Figure 6 This is a schematic diagram of the structure of the development equipment of the water conservancy and flood control emergency intelligent body based on Dify provided in the embodiment of this application. Figure 6 Shown, including: at least one processor; and, at least one processor communicatively connected to a memory; wherein, The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor to enable the at least one processor to execute the Dify-based water conservancy and flood control emergency intelligent agent development method as described in any of the above items.
[0061] An embodiment of the present application provides a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as follows: A method for developing a water conservancy and flood control emergency intelligent agent based on Dify as described in any of the above items.
[0062] The various embodiments in this application are described in a progressive manner. Similar portions between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the device and medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For relevant portions, refer to the descriptions of the method embodiments.
[0063] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects to their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0064] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0065] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0066] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0067] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0068] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0069] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0070] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can be implemented using any method or technology to store information. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change RAM (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media such as modulated data signals and carrier waves.
[0071] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0072] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. The development method of the water conservancy flood control emergency intelligent agent based on Dify is characterized by: The method comprises: In response to the triggering operation of the orchestration workflow for single-round tasks in Dify, the workflow corresponding to each water conservancy flood prevention emergency business scenario is constructed; According to the business execution logic of the intelligent agent, each workflow node is added in sequence to the workflow to realize the business process arrangement of the workflow corresponding to each water conservancy and flood prevention emergency business scenario; In response to a triggering operation on the complex multi-round dialogue workflow in Dify, a default conversation flow corresponding to the water conservancy and flood prevention emergency service is constructed; wherein the default conversation flow includes a start node, an LLM node, and a direct reply node; Add a problem classifier node to the default conversation flow, select the workflow corresponding to each of the water conservancy and flood prevention emergency business scenarios linked under the problem classifier node, add the workflow to the default conversation flow, and obtain the intelligent agent corresponding to each of the water conservancy and flood prevention emergency business scenarios.
2. The method for developing a water conservancy and flood control emergency agent based on Dify according to claim 1 is characterized in that: According to the business execution logic of the intelligent agent, each workflow node is added in sequence to the workflow to realize the business process arrangement of the workflow corresponding to each water conservancy and flood prevention emergency business scenario, specifically including: According to the business execution logic of the agent, a parameter extractor node, a code execution node, an LLM node and an end node are sequentially added to the workflow; Through the parameter extractor node, the code execution node, the LLM node and the end node, the business process orchestration of the workflow corresponding to each water conservancy and flood prevention emergency business scenario is realized.
3. The method for developing a water conservancy and flood control emergency agent based on Dify according to claim 2 is characterized in that: The business process arrangement of the workflow corresponding to each of the water conservancy and flood prevention emergency business scenarios is realized through the parameter extractor node, the code execution node, the LLM node and the end node, specifically including: Based on the parameter extractor node, obtain key information in the question initiated by the user; Based on the code execution node, the key information is used as an input parameter, a water conservancy and flood prevention emergency business scenario is determined according to the key information, corresponding water conservancy station data is obtained, and business analysis logic corresponding to the water conservancy and flood prevention emergency business scenario is determined; Based on the LLM node, the business analysis logic is inferred through a preset large model to output corresponding water conservancy and flood control emergency data; Based on the end node, the water conservancy and flood prevention emergency data is used as an output parameter to implement the business process arrangement of the workflow corresponding to each water conservancy and flood prevention emergency business scenario.
4. The method for developing a water conservancy and flood control emergency agent based on Dify according to claim 1 is characterized in that: The water conservancy and flood prevention emergency business scenarios include rainfall analysis, water situation analysis, rainfall forecast, water situation forecast, disaster forecast, briefing generation, emergency response assistant, plan execution, hazard handling, and material dispatch.
5. The method for developing a water conservancy and flood control emergency agent based on Dify according to claim 3 is characterized in that: Acquiring water conservancy station data corresponding to the water conservancy and flood prevention emergency business scenario and determining the business analysis logic corresponding to the water conservancy and flood prevention emergency business scenario, specifically including: Acquire water conservancy station data corresponding to the water conservancy flood prevention emergency business scenario, and process the water conservancy station data to obtain processed water conservancy station data; When the water conservancy and flood prevention emergency business scenario is rainfall analysis, the accumulated rainfall in a preset period is calculated based on the processed water conservancy station data, and a rainfall warning of a corresponding warning level is triggered based on the accumulated rainfall; When the water conservancy and flood prevention emergency business scenario is water condition analysis, special water conservancy stations with special water conditions are screened out from the water conservancy stations based on the processed water conservancy station data, as well as water condition information corresponding to the special water conservancy stations; When the water conservancy and flood prevention emergency business scenario is rainfall forecast, the average rainfall of the watershed is calculated based on the processed water conservancy station data, and the location of the center of the rainstorm is determined based on the average rainfall; In the case where the water conservancy and flood control emergency business scenario is a water situation forecast, calling a runoff generation and convergence model, determining a runoff generation and convergence call result corresponding to each water conservancy station based on the processed water conservancy station data, determining a historical peak flow corresponding to the water conservancy station based on the runoff generation and convergence call result, and uploading the historical peak flow to a flood control knowledge base; When the water conservancy and flood prevention emergency business scenario is disaster forecasting, determining the rainfall threshold, typhoon path, flood water level and address disaster risk distribution information based on the processed water conservancy station data; In the case where the water conservancy and flood prevention emergency business scenario is briefing generation, generating water and rainfall briefings corresponding to different report types based on the processed water conservancy station data; In the case where the water conservancy and flood prevention emergency business scenario is an emergency response assistant, a corresponding emergency response plan is selected from a preset plan knowledge base based on the processed water conservancy station data; In the case where the water conservancy flood prevention emergency business scenario is plan execution, generating an emergency response plan based on the processed water conservancy station data, and constructing the plan knowledge base based on the emergency response plan; When the water conservancy and flood prevention emergency business scenario is a dangerous situation handling, obtaining a dangerous situation handling technical specification document, building a dangerous situation knowledge base based on key information in the dangerous situation handling specification document, and obtaining a corresponding dangerous situation handling plan from the dangerous situation knowledge base based on the processed water conservancy station data; When the water conservancy and flood prevention emergency business scenario is material dispatch processing, a target emergency warehouse is selected according to the disaster information, and a dispatch plan corresponding to the target emergency warehouse is generated.
6. The method for developing a water conservancy and flood control emergency agent based on Dify according to claim 5 is characterized in that: After uploading the historical highest flood peak flow to the flood control knowledge base, the method further includes: According to the historical highest flood peak flow, the warning level corresponding to each water conservancy monitoring station is determined, and according to the warning level, the response measures corresponding to the warning level are retrieved from the flood control knowledge base.
7. The method for developing a water conservancy and flood control emergency agent based on Dify according to claim 5 is characterized in that: Select the target emergency warehouse based on the disaster information, including: Determine the types of supplies needed for the disaster based on the disaster information; According to the type of supplies, emergency warehouses that can provide supplies are screened, and according to the distance between the emergency warehouse and the disaster location, the emergency warehouse with the closest corresponding distance is selected as the target emergency warehouse.
8. The development device of the water conservancy and flood control emergency intelligent agent based on Dify is characterized by: The device comprises: The workflow construction module is used to respond to the triggering operation of the orchestration workflow for single-round tasks in Dify and build workflows corresponding to various water conservancy and flood prevention emergency business scenarios; An orchestration module, configured to sequentially add workflow nodes to the workflow according to the business execution logic of the agent, so as to implement business process orchestration of the workflow corresponding to each of the water conservancy and flood prevention emergency business scenarios; A default conversation flow construction module is used to construct a default conversation flow corresponding to the water conservancy and flood prevention emergency business in response to a triggering operation on the complex multi-round conversation workflow in Dify; wherein the default conversation flow includes a start node, an LLM node, and a direct reply node; An intelligent agent construction module is used to add a problem classifier node to the default conversation flow, select the workflow corresponding to each of the water conservancy and flood prevention emergency business scenarios linked under the problem classifier node, add the workflow to the default conversation flow, and obtain the intelligent agent corresponding to each of the water conservancy and flood prevention emergency business scenarios.
9. The development equipment of the water conservancy and flood control emergency intelligent agent based on Dify is characterized by: The device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the Dify-based water conservancy and flood control emergency intelligent agent development method as described in any one of claims 1 to 7.
10. A non-volatile computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions are configured to: A method for developing a water conservancy and flood control emergency intelligent agent based on Dify as described in any one of claims 1 to 7.