Skip to content

Commit

Permalink
Create copilot-log.md
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal authored Nov 4, 2023
1 parent 4511360 commit 2692286
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions prompt/copilot-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
```csharp
/*
I have a content input as : {1: {2: "Hello", 3: "!", 1: "World"}, 2: {1: "I", 3: "here", 2: "am"}}, please help me to construct input as entire content like human conversation
*/

[HttpGet(Name = "GetConversation")]
public string GetConversation()
{
var content = "{1: {2: \"Hello\", 3: \"!\", 1: \"World\"}, 2: {1: \"I\", 3: \"here\", 2: \"am\"}}";
var conversation = new StringBuilder();
var conversationDictionary = JsonConvert.DeserializeObject<Dictionary<int, Dictionary<int, string>>>(content);
foreach (var (key, value) in conversationDictionary)
{
conversation.Append($"Speaker {key}: ");
foreach (var (key1, value1) in value.OrderBy(x => x.Key))
{
conversation.Append($"{value1} ");
}
conversation.Append("\n");
}
return conversation.ToString();
}
```


```java
Map<Integer, Map<Integer, String>> input = Map.of(
1, Map.of(2, "world", 3, "!", 1, "Hello"),
2, Map.of(1, "I", 3, "here", 2, "am")
);
// add a method named printSortedValue in Calculator.java,
// the method should print the values in the input map in the order of the key of the outer map and the key of the inner map
// the output should be "Hello world ! I am here"
public void printSortedValue() {
// use java stream api to iterate the map and print the values to refactor the following code
for (int i = 1; i <= 2; i++) {
Map<Integer, String> innerMap = input.get(i);
for (int j = 1; j <= 3; j++) {
System.out.print(innerMap.get(j) + " ");
}
}
}
```

```kotlin
class RecombinationParagraph {
// given a map to storage json like below
// {
// 1: {
// 2: "world",
// 3: "!",
// 1: "Hello"
// },
// 2: {
// 1: "I",
// 3: "here",
// 2: "am"
// }
// }
// create a function to recombine the map to a string like below:
// Hello world!
// I am here !
// generate code here
fun recombine(map: Map<Int, Map<Int, String>>): String {
val sb = StringBuilder()
for (i in 1..map.size) {
val innerMap = map[i]
for (j in 1..innerMap!!.size) {
sb.append(innerMap[j])
sb.append(" ")
}
sb.append("\n")
}
return sb.toString()
}
}
```

```java
// create a method is to contact charactors by sequesnce number
// the input is nested json format, output is a string
// for example
// input: {1: {1: 'a', 2: 'b', 3: 'c'}}
// output: 'abc'
// if the input has multiple members, the output should be seperated by two line breaks
```

Chat

```
1. learn following data format as method input '''{ 1: { 2: "world", 3: "!", 1: "Hello"}, 2: { 1: "I" , 3: "here", 2: "am" } }'''
2. generate a method which takes above input and print message line by line regarding the key value ascending
3. please do not add new line for the second level key
```

1.先用这个生成map,然后它会一行一行提示出来
```java
// generate a map to contains the following json, json is quote in ```
// { 1: { 2: "world",
// 3: "!",
// 1: "Hello"},
// 2: { 1: "I" ,
// 3: "here",
// 2: "am" }
//}
```

2.用这个生成代码
```
// create a method to combine word in a map to a sentence, the map is generated by generateMap method
// should combine then by the order of the key, the key is integer
```


可以让 GPT 代写 prompt

write a prompt for javascript code, the code should do the following
1. the input is a json string,
2. the output is a combination of the json data. following is an example input
`{ 1: { 2: "world", 1: "hello", 3: "!" }, 2: { 2: "am", 1: "I", 3: "here" }, }`

output
`hello world!
I am here`

0 comments on commit 2692286

Please sign in to comment.