gpt4 book ai didi

ruby-on-rails - 当我将多行指令粘贴到其中时,Rails 控制台会启动一个 "Display all 573 possibilities? (y or n)"对话框

转载 作者:行者123 更新时间:2023-12-03 16:04:50 24 4
gpt4 key购买 nike

我正在将以下代码片段从我的文本编辑器复制到我的 rails 控制台:

request = Typhoeus::Request.new(
"https://track.customer.io/api/v1/customers/4",
ssl_verifypeer: false,
method: :put,
headers: {
"Content-Type" => "application/json",
"User-Agent" => "#{Rails.configuration.customerio[:site_id]}:#{Rails.configuration.customerio[:api_key]}"},
body: '{
"email":"first@last.com",
"name":"Name is here",
"id":"4",
"created_at":"#{Time.now}"}')

当我将其全部复制为一行时:
request = Typhoeus::Request.new("https://track.customer.io/api/v1/customers/4", ssl_verifypeer: false,method: :put,headers: {"Content-Type" => "application/json","User-Agent" => "#{Rails.configuration.customerio[:site_id]}:#{Rails.configuration.customerio[:api_key]}"},body: '{"email":"first@last.com", "name":"Name is here","id":"4","created_at":"#{Time.now}"}')

然后控制台返回标准响应:
 => #<Typhoeus::Request:0x00000101c517a8 @base_url="https://track.customer.io/api/v1/customers/4", @original_options=...

但是,如果我逐行复制它(就像我在第一个代码片段中所做的那样),我会收到一个奇怪的错误。控制台询问我是否要显示所有可能性,就好像我正在搜索目录或在粘贴中途进行搜索查询一样。一探究竟:
1.9.3p393 :091 > request = Typhoeus::Request.new(
1.9.3p393 :092 > "https://track.customer.io/api/v1/customers/4",
1.9.3p393 :093 > ssl_verifypeer: false,
1.9.3p393 :094 > method: :put,
1.9.3p393 :095 > headers: {
1.9.3p393 :096 >
Display all 573 possibilities? (y or n)
1.9.3p393 :096 > "Content-Type" => "application/json",
1.9.3p393 :097 >
Display all 573 possibilities? (y or n)
1.9.3p393 :097 > "User-Agent" => "#{Rails.configuration.customerio[:site_id]}:#{Rails.configuration.customerio[:api_key]}"},
1.9.3p393 :098 > body: '{
1.9.3p393 :099'> "email":"first@last.com",
1.9.3p393 :100'> "name":"Name is here",
1.9.3p393 :101'> "id":"4",
1.9.3p393 :102'> "created_at":"#{Time.now}"}')

如果我选择 n两次,请求都是正常创建的。但是,如果我选择 y ,它列出了 573 个项目,其中大部分我都放入了这个馅饼: http://pastie.org/private/ksgzqhd50mvdi0t6cqe8g

你知道这些结果是什么吗,更重要的是,为什么在这个奇怪的时间提示它们?

最佳答案

听起来您从中复制代码的来源有两个制表符,其中 "Content-Type"..."User-Agent"...是缩进的。两个制表符将调用控制台中的自动完成列表(您看到的提示是当可能的完成次数超过某个阈值时)。

请注意,如果您从自己的 StackOverflow 帖子中复制并粘贴它,您不应该看到自动完成提示,因为它使用空格作为缩进而不是制表符。

编辑:

为了证实我的怀疑,请在编辑器中打开“显示空白”以查看这两行开头是否有制表符。

个人意见:如果您还没有这样做,我建议您将编辑器配置为为 Tab 键按下插入空格。标签是魔鬼的空白:)。

关于ruby-on-rails - 当我将多行指令粘贴到其中时,Rails 控制台会启动一个 "Display all 573 possibilities? (y or n)"对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18136914/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com