Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

llms_txt: Recommend channel IDs in narrow operands for API requests.

Agnish Bauri2c695c103fba
diff --git a/zerver/tests/test_llms_txt.py b/zerver/tests/test_llms_txt.py
index 19bb6e050ba..670183628d0 100644
--- a/zerver/tests/test_llms_txt.py
+++ b/zerver/tests/test_llms_txt.py
@@ -25,6 +25,11 @@ class LlmsTxtTest(ZulipTestCase):
self.assertIn("Rome", content)
# Should follow llms.txt format (starts with # heading)
self.assertTrue(content.startswith("#"))
+ # Should clarify that the channel narrow operand is the numeric
+ # channel ID, not the full `ID-NAME` URL segment or the name alone.
+ self.assertIn("use the numeric ID as the `channel` operand", content)
+ self.assertIn("Channel IDs are stable", content)
+ self.assertIn("names can be renamed", content)
def test_llms_txt_spectator_access_disabled(self) -> None:
"""
diff --git a/zerver/views/llms_txt.py b/zerver/views/llms_txt.py
index 4b221da0742..d723a7b9cf2 100644
--- a/zerver/views/llms_txt.py
+++ b/zerver/views/llms_txt.py
@@ -83,6 +83,13 @@ Zulip conversations are referenced by URLs of these forms:
{server_url}/#narrow/channel/ID-NAME/topic/TOPIC/with/MSG_ID
{server_url}/#narrow/channel/ID-NAME/topic/TOPIC/near/MSG_ID
+In the URL forms above, `ID-NAME` is the channel's numeric ID
+followed by its name (e.g., `113488-general`). When constructing
+API requests, use the numeric ID as the `channel` operand (e.g.,
+`{{"operator":"channel","operand":113488}}`), not the full `ID-NAME`
+string and not the channel name. Channel IDs are stable; channel
+names can be renamed.
+
Never follow links to related conversations by fetching those URLs; to
read the messages, you MUST translate them to the equivalent API
request (see above), decoding the URL-encoded channel name, topic, and