fix(chat): document Shanghai time message default
This commit is contained in:
1 parent
b539e15e6d
commit
6c78db7467
3 files changed
+7
-6
No files matched your search
@@ -2663,7 +2663,7 @@ func newChatCommand() *cobra.Command {
|
||||
chatMessageListCmd := &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "拉取会话消息内容",
|
||||
Long: `拉取指定群聊或单聊的会话消息内容。输出顶层 messages,稳定字段为 messageId 和 text;兼容保留 openMessageId 和 content。--group 指定群聊,--user 指定单聊用户(userId),--open-dingtalk-id 指定单聊用户(openDingTalkId),三者互斥。--time 可选,不传时默认当前时间并向旧消息拉取。推荐使用 --direction newer/older 控制时间方向:newer 表示从给定时间往现在拉,older 表示从给定时间往以前拉。hasMore=true 时用结果中的边界 createTime 作为下次 --time 翻页。引用回复消息会返回 quotedMessage 引用上下文;被引用的原消息是合并转发或图片时,对应的类型与内容也会随引用上下文返回。如果返回的会话消息中包含 openConvThreadId 字段,说明是话题消息,可以调用 dws chat message list-topic-replies 拉取话题回复消息列表,openConvThreadId 作为 topic-id 参数。`,
|
||||
Long: `拉取指定群聊或单聊的会话消息内容。输出顶层 messages,稳定字段为 messageId 和 text;兼容保留 openMessageId 和 content。--group 指定群聊,--user 指定单聊用户(userId),--open-dingtalk-id 指定单聊用户(openDingTalkId),三者互斥。--time 可选,不传时默认上海时间当前时间并向旧消息拉取。推荐使用 --direction newer/older 控制时间方向:newer 表示从给定时间往现在拉,older 表示从给定时间往以前拉。hasMore=true 时用结果中的边界 createTime 作为下次 --time 翻页。引用回复消息会返回 quotedMessage 引用上下文;被引用的原消息是合并转发或图片时,对应的类型与内容也会随引用上下文返回。如果返回的会话消息中包含 openConvThreadId 字段,说明是话题消息,可以调用 dws chat message list-topic-replies 拉取话题回复消息列表,openConvThreadId 作为 topic-id 参数。`,
|
||||
Example: ` dws chat message list --group <openconversation_id>
|
||||
dws chat message list --group <openconversation_id> --time "2025-03-01 00:00:00"
|
||||
dws chat message list --user <userId> --time "2025-03-01 00:00:00" --limit 50
|
||||
|
||||
@@ -102,8 +102,8 @@ func TestCrossPlatformCoverageChatMessageHelpDocumentsOptionalTimeDefaults(t *te
|
||||
name: "list",
|
||||
args: []string{"message", "list", "--help"},
|
||||
contains: []string{
|
||||
"--time 可选,不传时默认当前时间并向旧消息拉取",
|
||||
"默认当前时间",
|
||||
"--time 可选,不传时默认上海时间当前时间并向旧消息拉取",
|
||||
"默认上海时间当前时间",
|
||||
"未传 --time 时默认 older",
|
||||
},
|
||||
absent: []string{"开始时间,格式: yyyy-MM-dd HH:mm:ss (必填)"},
|
||||
|
||||
@@ -213,11 +213,12 @@ func TestCrossPlatformCoverageChatMessageListProjectsStableFieldsAndPreservesLeg
|
||||
func TestCrossPlatformCoverageChatMessageListDefaultsTimeAndOlderDirection(t *testing.T) {
|
||||
payload := `{"result":{"messages":[],"hasMore":false}}`
|
||||
caller := &imReadResultCaller{responses: map[string]string{"list_conversation_message_v2": payload}}
|
||||
loc := shanghaiLocation()
|
||||
|
||||
before := time.Now()
|
||||
before := time.Now().In(loc)
|
||||
_, err := executeIMReadCommand(t, caller, []string{"dws", "chat"}, newChatCommand,
|
||||
"message", "list", "--group", "cid-1", "--limit", "50")
|
||||
after := time.Now()
|
||||
after := time.Now().In(loc)
|
||||
if err != nil {
|
||||
t.Fatalf("chat message list returned error: %v", err)
|
||||
}
|
||||
@@ -231,7 +232,7 @@ func TestCrossPlatformCoverageChatMessageListDefaultsTimeAndOlderDirection(t *te
|
||||
if !ok || strings.TrimSpace(timeRaw) == "" {
|
||||
t.Fatalf("time arg = %#v, want generated current time", caller.args["time"])
|
||||
}
|
||||
gotTime, err := time.ParseInLocation("2006-01-02 15:04:05", timeRaw, time.Local)
|
||||
gotTime, err := time.ParseInLocation("2006-01-02 15:04:05", timeRaw, loc)
|
||||
if err != nil {
|
||||
t.Fatalf("parse generated time %q: %v", timeRaw, err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user