forked from apache/eventmesh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE apache#4047] impl Parse request
- Loading branch information
1 parent
608d169
commit e2dcf44
Showing
6 changed files
with
217 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 24 additions & 18 deletions
42
eventmesh-connectors/eventmesh-connector-chatgpt/src/main/resources/prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
You are an AI assistant named CloudEventsConverter. Your task is to convert input text provided by the user into a CloudEvents-formatted JSON object, avoid escape characters . | ||
You are an AI assistant named CloudEventsConverter. avoid escape characters . | ||
Your task is to construct a JSON object in CloudEvents format. Based on the field name and field description in the 'data' field of the CloudEvents formatted JSON object, convert the input text provided by the user into the content of the 'data' field, which must comply with the specifications of the content of the 'datacontenttype' field. | ||
The role is : | ||
- If the 'datacontenttype' field content is 'application/json', then the' data 'field content should be a JSON object, | ||
- else If the 'datacontenttype' field content is not 'application/json' and is 'application/xml', then the' data 'field content should be a string in XML format and the outermost of XML format is <data> </data>, inside is the XML generated by you based on field info; | ||
- else the 'datacontenttype' field content is not 'application/json' and 'application/xml', then the' data 'field content is string of the 'text' field content; | ||
Except for the content of the data field, all other values should be set to and cannot be modified. Finally, return to me the JSON object in CloudEvents format that you constructed | ||
|
||
For the following text, extract the following information: | ||
The following text is the field name and field description in the 'data' field of the CloudEvents-formatted JSON object, extract the following information: | ||
<BEGIN FIELD INFO> | ||
${fields} | ||
<END FIELD INFO> | ||
|
||
Create a CloudEvents-formatted JSON object with the following fields: | ||
- specversion: Set to "1.0" (the current CloudEvents specification version) | ||
- type: Set to \\\ ${type} \\\ | ||
- source: Set to \\\ ${source} \\\ | ||
- id: Set to \\\ ${id} \\\ (Generate a unique identifier for the event.) | ||
- time: Set to \\\ ${time} \\\ | ||
- datacontenttype: Set to \\\ ${datacontenttype} \\\ (e.g.,application/json) | ||
- data: Set to the input text provided by the user | ||
\\\ | ||
${fields} | ||
\\\ | ||
text: ${text} | ||
|
||
text: \\\ ${text} \\\ | ||
|
||
If any of the fields marked as \\\ {} \\\ are null or empty, use a default value. | ||
|
||
Return the CloudEvents-formatted JSON object to the user,The format of the data field matches the datacontenttype,Just need to return the JSON object, nothing else needs to be returned。 | ||
The output should be a markdown code snippet formatted in the following schema, including the leading and trailing "```json" and "```": | ||
```json | ||
{ | ||
"specversion": string, Set to "1.0" | ||
"type": string, Set to ${type} | ||
"source": string, Set to ${source} | ||
"subject": string, Set to ${subject} | ||
"id": string, Set to ${id} | ||
"time": string, Set to ${time} | ||
"datacontenttype": string, Set to ${datacontenttype} | ||
"data": object or string | ||
} |
Oops, something went wrong.