【软件架构】使用ChatGPT构建系统图-第一部分
视频号
微信公众号
知识星球
对思维导图感兴趣 — 阅读我们关于使用plantUML和ChatGPT创建令人敬畏的思维导图的博客文章
ChatGPT的受欢迎程度不断增长,目前已被广泛应用。作为一名软件架构师,我有机会探索ChatGPT在金融领域的功能,特别是财富管理。
我想确认ChatGPT是否可以为用例解释生成图表,并同时分析多个因素。
所以,我登录了chat.openai.com,下面是我的对话
步骤1:让我们定义用例
我本可以定义自己的用例,但我想测试ChatGPT的所有方面,所以我要求它为我定义一个。
步骤2:让我们为用例定义一个数据模型
在我看来很好,让我们从定义数据模型开始——所以我请ChatGPT来做,这就是我得到的
这听起来不错,让我们看看它能为图表做些什么。我想更深入地研究数据模型,所以我的下一个提示是
Prompt:describe the data model in more detail or tabular format using markdown
ChatGPT: I can describe the structure of the data model in a tabular format using markdown.
这是一个良好的开端。接下来,我要求定义关系
第3步:让我们定义关系-实体关系图
Prompt: this is perfect, I would like to depict the relationships in a mermaid diagram, can you give me the markdown code to do this
ChatGPT: I apologize, but as a text-based model, I am not able to generate Mermaid diagrams or any other visual diagrams. However, I can provide you with an example of how the relationships could be represented in Mermaid syntax:
在{merma}标签内的降价编辑器中复制这个,我得到了
太好了,我们正在取得进展。
我有一个类图/实体关系图。让我们看看还有什么可能
步骤4:序列图
接下来,我尝试做出假设性提示来检查响应。我的第一个意图是创建一个序列图
Prompt: how would a Buy transaction for an asset impact the tables mentioned above, I would like to depict this as a sequence diagram. Can you help describe the diagram in markdown format for mermaid
ChatGPT: Sure, aBuy
transaction would have an impact on the following tables:
Asset
table: thecurrent_value
of the asset would be updated to reflect the current market value of the asset
Portfolio
table: thecurrent_value
of the portfolio would be updated to reflect the new asset and its market value, and theasset_allocation
would be updated to reflect the new asset.
Transaction
table: a new transaction would be added with the transaction details such as the transaction type, transaction date, asset_id, and portfolio_idHere is an example of how the process could be represented in a Mermaid sequence diagram:
在markdown编辑器中复制这个
给人印象深刻的但我还没有完成
步骤5:状态转换图
让我问一下状态转换图
Prompt: Will the account have states like new, closed, active inactive etc? I would like to depict the states in a state diagram using mermaid. Can you help describe the diagram in markdown format
ChatGPT: It is common for financial accounts to have different states, such as new, closed, active, and inactive, to reflect the current status of the account.
new
account would be one that has just been opened and is awaiting funding or verification.
active
account would be one that is currently open and being used for transactions.
inactive
account would be one that is not currently being used but has not been closed.
closed
account would be one that has been closed by the customer or the financial institution, and no longer able to be used for transactions.
Pending
state could be used to indicate that the account is under review or awaiting verification.
Suspended
state could be used to indicate that the account has been temporarily suspended, for example, due to suspicious activity or non-compliance with terms and conditions.
Frozen
state could be used to indicate that the account has been frozen, for example, due to a legal dispute or regulatory action.
Expired
state could be used to indicate that the account has reached its expiration date and is no longer in use.here is an example of how the states of an account could be represented in a Mermaid state diagram:
看起来,此格式较旧,可能会由于循环依赖关系而中断。所以我要求ChatGPT对此进行改进
Prompt: can you try giving the state diagram markdown syntax in new format using
[*]
ChatGPT: Sure, here is an example of how a state diagram for a wealth management system's account management component could be represented in Mermaid using the new format with[*]
:
标记编辑器表示
此图显示了帐户的不同状态以及它们之间可能的转换。
- 初始状态为[*],表示开始状态。
- 帐户可以通过激活从“新建”状态转换为“活动”状态。
- 帐户可以通过关闭从“新建”状态转换为“关闭”状态。
- 帐户可以通过停用从活动状态转换到非活动状态。
- 帐户可以通过关闭从活动状态转换到关闭状态。
- 帐户可以通过激活从非活动状态转换为活动状态。
- 帐户可以通过关闭从非活动状态转换为关闭状态。
现在我们正在取得进展。让我们进一步扩展到包括其他州
Prompt: please include expired, frozen and other relevant states as well
ChatGPT: Sure, here is an example of how a state diagram for a wealth management system’s account management component could be represented in Mermaid including additional states such asExpired
,Frozen
, etc:Description:
This diagram shows the different states of an account and the possible transitions between them.The initial state is
[*]
which denotes the start state.
The account can transition fromNew
state toActive
state by activating it.
The account can transition fromNew
state toClosed
state by closing it.
The account can transition fromActive
state toInactive
state by deactivating it.
The account can transition fromActive
state toFrozen
state by freezing it.
The account can transition fromActive
state toClosed
state by closing it.
The account can transition fromInactive
state toActive
state by activating it.
The account can transition fromInactive
state toFrozen
state by freezing it.
The account can transition fromInactive
state toClosed
state by closing it.
The account can transition fromFrozen
state toActive
state by unfreezing it.
The account can transition fromFrozen
state toClosed
state by closing it.
The account can transition fromClosed
state toExpired
state if the account is expired.
和图解表示
这太棒了。ChatGPT和Mermaid所能取得的成就令人印象深刻
接下来,我将使用C4模型描述和构建更多的图表,并将它们添加到后续文章中
感谢阅读!
- 598 次浏览