paint-brush
作为产品经理和非程序员,我如何使用 ChatGPT 开发旅行 AI 应用程序经过@dinpd
4,588 讀數
4,588 讀數

作为产品经理和非程序员,我如何使用 ChatGPT 开发旅行 AI 应用程序

经过 NPD PM8m2023/08/24
Read on Terminal Reader

太長; 讀書

我不仅能够构建(我认为是)一个有用的应用程序,而且能够熟悉现代框架并获得一些实践时间,而不会淹没在语法和框架学习中,这正是我想要的。我认为这是一件大事,为更多的人打开了软件开发的大门。
featured image - 作为产品经理和非程序员,我如何使用 ChatGPT 开发旅行 AI 应用程序
NPD PM HackerNoon profile picture
0-item
1-item

我做到了!我花了大约 100 个小时,但在 ChatGPT 的帮助下我能够编写和部署一个真正的应用程序。


此后我又花了 100 个小时左右维护和添加功能,因此变成了一个充满激情的项目。


实验的前提是“我作为一名产品经理,长时间没有主动编写代码,是否可以使用 ChatGPT 来设计、构建和部署应用程序?”


我拥有良好的基础,获得了计算机科学学士学位,并参与了技术的各个方面(系统设计、开发、开发运营、托管),但在过去 10 多年里我没有亲自进行开发。


我有很好的产品意识,可以理解如何迭代地构建产品以及如何审查功能,我认为这很有帮助。


与软件开发一样,80% 以上的时间都花在故障排除和调试上。

为什么选择人工智能旅行

在我围绕 ChatGPT API 整合一些有用的东西的过程中,我认为 GPT 具有独特的资格来解决旅行计划的问题 - 确定要去的地方、要去的兴趣点、行程等。有很多决定需要做出我认为在旅行时制作并让某人根据独特的喜好或情况为您整理所有这些内容是很有价值的。

使用 ChatGPT 进行编码

我花了大约 6 个星期的时间,晚上加班加点周末,总共大概 100 个小时。我有 ChatGPT+ 帐户,因此在访问机器人和访问 GPT4 时给了我更好的稳定性。


以下是我在这个过程中的发现:


  • ChatGPT 帮助我选择了适合这项工作的工具(用于单页应用程序的 Vue.js 框架)并在迭代中编写代码。没有它我绝对不可能做到。话虽如此,肯定存在复杂性:


    1. ChatGPT UI 施加的限制(输入和输出上的 4k 令牌以及看起来大约 15k 的上下文)非常严格,您最终会在问题中进行大量分段。这不太理想并且需要额外的努力。我没有尝试通过 CLI 访问 - 只是在某处读到它没有施加相同的限制 - 值得一试。

    2. “理解代码”的质量一直不一致——有时做得更好,有时做得更差。我不确定这有什么关系。

    3. 因此,我的建议是尽早开始构建代码(将代码分解为更小的函数),因为 ChatGPT 不会自动为您做这件事,但如果您提出要求,它就会这样做。它使以后的故障排除更加容易。

    4. GPT4 在 3 小时内进行 25 次查询后退出,并将您切换到“默认”模型,我认为它是 3.5 - 有趣的是,它恢复得很好,我几乎想说它比 GPT4 更好,但因为我没有开始与 3.5 相比,这不是同类比较。


      更新:限制最近已提高到 3 小时内 50 次查询。


开发和部署环境

  • 我将 Replit 用于新时代的 IDE。这是一个很好的概念,并且可能是未来,特别是如果他们可以将其与有意义的 Codex/ChatGPT 集成结合起来。他们目前拥有的人工智能并不是那么有用,因为它没有利用项目中的代码,并且需要与我在 ChatGPT 上所做的所有相同的操作和来回操作。不过,我真的很喜欢 Replit 如何与 Github 集成以进行源代码控制,以及它如何处理暂存。


  • 我使用 Cloudflare 进行部署,因为我想部署为云原生。我使用 CF 页面作为 UI,使用工作人员作为后端(API 网关)。我喜欢这些页面如何与 CICD 的 Github 集成 - 这真的很酷 - 基本上应用程序会在对主分支的任何提交上重新部署自身。


    总的来说,CF 很出色,因为它简化了大量网络难题。

迅速的

我花了相当多的时间,对提示进行了多次迭代,将其清除并尝试解决特性。早期的决策点之一是是否让 ChatGPT API 返回一个文本列表,然后我会尝试理解该文本列表并对其进行分类,或者让它返回已经内置结构的 JSON。需要将文本数据解释为结构的前景让我感到害怕,因为当我从 ChatGPT 请求越来越多的数据时,结构变得越来越复杂(正如这个片段所证明的那样)


瑞士10日游行程


因此,我决定提示 ChatGPT 输入 JSON。然而,这有其自身的副作用,即 JSON 并不总是结构良好,或者提示中存在太多歧义,ChatGPT 会返回我没有预料到的结果。我想说我在提示微调和 JSON 错误处理之间花费了接近 25% 的时间。这是一次很好的学习经历。最终,这是我得到的提示:


 SYSTEM_PROMPT = `You are a helpful travel assistant. You perform the requests with diligence and make the best attempt to answer the questions, never refusing due to complexity etc. Reset the conversation if I mention a new location in my user prompt. Return the results in JSON format as an array of objects. Make sure JSON format is complete and valid and does not include unescaped special characters. Please avoid escaping double quotes and instead use single quotes or another method to prevent JSON parsing issues. Do not use "\n" newline symbols in the middle of element text. Each object in the array should have the following keys: - "title" - "description" - "airportCode" (for the destination airport) - "poi" (array of points of interest) - "lodging" (array of lodging options) - "itinerary" (array of objects, each representing a day) - "considerations" - "history" (history related to the destination) - "key_local_phrases" (array of common local phrases) - "cost" The "itinerary" key should contain an array of objects, each object representing a day with the key "activities", which is itself an array of objects. Each activity object should have the following keys: - "description" - "waypoint" (name of the location, not coordinates) - "cost" - "travelTime" - "travelOptions" If travel is involved within the itinerary, include "Travel To" as part of the daily activity and provide the travel time, travel options, and associated cost. Each step in the itinerary should also suggest representative local "food" to try. Focus on most interesting points of interest, lodging, and activities. Consider activities that are popular, affordable, and recommended by the travelers. Make sure you cover the entire duration of the trip or outing. If it says "week-long", it has to cover the entire week. It's OK to group multiple days or weeks together if it's a longer trip. If it doesn't give a timeframe, take a guess based on the nature of a trip. Considerations should include travel restrictions and visa requirements, typical weather, criminogenic conditions including which areas to avoid, recommendations on visit timing, parking situation, and ways to save on travel costs. Here is an example of the desired output format: [ { "title": "Sample Title", "description": "Sample Description", "airportCode": "XYZ", "poi": ["Sample POI1", "Sample POI2"], "lodging": ["Sample Lodging1", "Sample Lodging2"], "itinerary": [ { "day": "Sample Day 1-2 - City or Place", "location": "Wikipedia identifiable name of the place in city,_country or city,_state format", "activities": [ { "description": "Sample Activity1", "waypoint": "Sample Waypoint1 connected to the activity", "cost": "$100", "travelTime": "30 minutes", "travelOptions": "Taxi or Bus" }, { "description": "Sample Activity2", "waypoint": "Sample Waypoint2 connected to the activity", "cost": "$50", "travelTime": "1 hour", "travelOptions": "Ferry or Bus" } ], "food": ["Sample Food1 with short description", "Sample Food2 with short description"] }, { "day": "Sample Day 3 - City or Place", ... }, { "week": "Sample Week 2 - City or Place", ... } ], "considerations": "Sample considerations text", "history": "Sample history text", "key_local_phrases": ["Sample phrase 1 - translation", "Sample phrase 2 - translation"], "cost": "Sample total cost" } ]`;


注意:截至撰写本文时,OpenAI 刚刚发布了微调增强功能,我认为这对于使 JSON 结构化数据返回更加稳健和一致非常有帮助。

愿望清单

目前我的愿望清单上最大的项目是开发环境/AI 代码生成集成。来回粘贴东西,不要弄乱代码结构(特别是当代码库变得更大时)肯定还有很多不足之处。


我认为人工智能代码生成的下一个重大步骤将是集成智能代码编辑器,它可以在内部将代码解析为多个部分,并且可以向模型提供和接受来自模型的相关输入,而无需用户手动执行此操作。


之后的下一步将是与浏览器集成以进行调试,最终创建闭环迭代调试周期。


这将是一个很酷的项目!


注:我很好奇谷歌在IDX 项目上有什么秘密——可能就是这样。

概括

总的来说,我不仅能够构建(我认为是)一个有用的应用程序,而且能够熟悉现代框架并获得一些实践时间,而不会淹没在语法和框架学习中,这正是我想要的。我认为这是一件大事,为更多的人打开了软件开发的大门。


您可以在VoyageAI.app找到该应用程序。该应用程序现在和将来都可以免费使用,没有广告,也无需登录(因此不使用个人数据)。