使用ChatGPT制作编程语言关系图

93 阅读1分钟

要是以前想要搜集有多少种编程语言,估计得查询不少资料,但是有了ChatGPT,几分钟就能够做好。

Prompts

要想GPT返回预设的结果,首先当然是修改提示词。如果不会写,提示词也可以让ChatGPT帮助来写,这是我让GPT帮忙写的提示词,非常标准。

Always return data in the following JSON format, and ensure all content is within this JSON:
{
  "nodes": [
    {
      "title": "Name 1",
      "id": "1eFJE77mYU0bNruKSga0jBVN",
      "desc": "Detailed explanation of Name 1."
    },
    {
      "title": "Name 2",
      "id": "6ZNo3bK3khkVZI7AWDZodHQO",
      "desc": "Detailed explanation of Name 2."
    }
  ],
  "links": [
    {
      "source": "1eFJE77mYU0bNruKSga0jBVN",
      "target": "6ZNo3bK3khkVZI7AWDZodHQO"
    }
  ]
}
- The "id" in "nodes" should be in UUID format and unique.
- The "title" in "nodes" should be the name of each step, not in the format step1, step2.
- The "desc" in "nodes" should be a detailed explanation of each step.
- Each "links" entry represents a connection.
- The "source" and "target" in "links" should be the "id" from the "nodes".

Customize ChatGPT

写好提示词后,就可以将提示词填写在Customize ChatGPT的“How would you like ChatGPT to respond?”中,点击保存,新发起的提问,ChatGPT就会按照Prompts来回复。

提问

我这里直接使用的是中文提问,得到的答案正好符合预期,点击compy code,将json存储为文件data.json。 image.png

导入数据

图形工具我使用的是addgraph(在producthunt上找到的一个工具),点击图形框顶部的Import data按钮,选择刚刚保存的data.json,初始导入后是随机排序的。

image.png

更改颜色布局

简单的改了一个配色,再选择顶部的layout type下拉,布局有五种方式,我这里选择了水平布局,这样就能清楚的看到ChatGPT绘制出的常用的50种编程语言关系图。

programmingLanguageRelationshipDiagram.png

效果图