ChatGPT相关工具

除去直接在https://chat.openai.com/中问答,借助openai提供的API接口,还有各种实用的衍生工具


chatdoc.com


网站chatdoc.com 使用ChatGPT 分析文档


cursor.so


可以用command+K提出需求 直接生成新代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package main

import (
"fmt"
"net/http"
"time"
)

func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Current time is: %s", time.Now().Format("2006-01-02 15:04:05"))
})

http.ListenAndServe(":8080", nil)
}

目标是 描述好需求,自动生成代码

集成 GPT-4 的代码生成器 Cursor 使用体验如何?怎么用更高效?


或者用command+L,对话框问答形式进行交互,这和直接在chat.openai.com上操作差不多

(其实推荐的用法使用command+K生成代码,其中有不理解的用command+L解释)


mersennePrime.go:*

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main

import (
"fmt"
"math"
)

func isPrime(n int) bool {
if n <= 1 {
return false
}
for i := 2; i <= int(math.Sqrt(float64(n))); i++ {
if n%i == 0 {
return false
}
}
return true
}

func main() {
for i := 2; i < 10000; i++ {
if isPrime(i) && isPrime((1<<uint(i))-1) {
fmt.Println(i, (1<<uint(i))-1)
}
}
}

mersennePrime_test.go:*

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package main

import "testing"

func TestIsPrime(t *testing.T) {
testCases := []struct {
input int
expected bool
}{
{1, false},
{2, true},
{3, true},
{4, false},
{5, true},
{6, false},
{7, true},
{8, false},
{9, false},
{10, false},
{11, true},
{12, false},
{13, true},
{14, false},
{15, false},
{16, false},
{17, true},
{18, false},
{19, true},
{20, false},
}

for _, tc := range testCases {
if isPrime(tc.input) != tc.expected {
t.Errorf("isPrime(%d) = %v, expected %v", tc.input, !tc.expected, tc.expected)
}
}
}

func TestMersennePrimes(t *testing.T) {
testCases := []struct {
input int
expected int
}{
{2, 3},
{3, 7},
{5, 31},
{7, 127},
{13, 8191},
}

for _, tc := range testCases {
if !isPrime(tc.expected) {
t.Errorf("%d is not a prime number", tc.expected)
}
if (1<<uint(tc.input))-1 != tc.expected {
t.Errorf("Mersenne prime for %d is %d, expected %d", tc.input, (1<<uint(tc.input))-1, tc.expected)
}
}
}


关于梅森素数


浏览器及IDE插件


这几个插件目前的作用,也只是将内容复制到chat.openai.com,再将返回值呈现…也有些价值,能免去复制粘贴,以及会有一些便捷指令啥的(如生成单测,不需要手敲这几个字了,点一下即可)

https://chatgpt.cn.obiscr.com/getting-started/


ChatGPT指令生成器

https://openprompt.co

https://github.com/f/awesome-chatgpt-prompts