Skip to content

Commit b64c823

Browse files
author
Dijana Pavlovic
committed
Correctly use bash with multiline strings
1 parent 7357518 commit b64c823

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

docs/intro/tutorials/ai_fastapi_searchbot.rst

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ with semantic search-based cross-chat memory.
186186
"response": "string",
187187
}
188188
189-
1. Implement web search
189+
3. Implement web search
190190
=======================
191191

192192
Now that we have our web app infrastructure in place, let's add some substance
@@ -956,53 +956,53 @@ In this tutorial we'll write queries using :ref:`EdgeQL <ref_intro_edgeql>` and
956956
957957
That concludes our User-related functionality. Next, we need to handle Chats and Messages. Since the process is quite similar to what we've just covered, we won't go into detail. Instead, you can implement these endpoints yourself as an exercise or simply copy the following code if you're in a rush.
958958
959-
.. code-block:: txt
959+
.. code-block:: bash
960960
:class: collapsible
961961
962+
$ echo 'select Chat {
963+
> messages: { role, body, sources },
964+
> user := .<chats[is User],
965+
> } filter .user.name = <str>$username;
966+
> ' > app/queries/get_chats.edgeql &&
962967
echo 'select Chat {
963-
messages: { role, body, sources },
964-
user := .<chats[is User],
965-
} filter .user.name = <str>$username;
966-
' > app/queries/get_chats.edgeql &&
967-
echo 'select Chat {
968-
messages: { role, body, sources },
969-
user := .<chats[is User],
970-
} filter .user.name = <str>$username and .id = <uuid>$chat_id;
971-
' > app/queries/get_chat_by_id.edgeql &&
968+
> messages: { role, body, sources },
969+
> user := .<chats[is User],
970+
> } filter .user.name = <str>$username and .id = <uuid>$chat_id;
971+
> ' > app/queries/get_chat_by_id.edgeql &&
972972
echo 'with new_chat := (insert Chat)
973-
select (
974-
update User filter .name = <str>$username
975-
set {
976-
chats := assert_distinct(.chats union new_chat)
977-
}
978-
) {
979-
new_chat_id := new_chat.id
980-
}' > app/queries/create_chat.edgeql &&
973+
> select (
974+
> update User filter .name = <str>$username
975+
> set {
976+
> chats := assert_distinct(.chats union new_chat)
977+
> }
978+
> ) {
979+
> new_chat_id := new_chat.id
980+
> }' > app/queries/create_chat.edgeql &&
981981
echo 'with
982-
user := (select User filter .name = <str>$username),
983-
chat := (
984-
select Chat filter .<chats[is User] = user and .id = <uuid>$chat_id
985-
)
986-
select Message {
987-
role,
988-
body,
989-
sources,
990-
chat := .<messages[is Chat]
991-
} filter .chat = chat;' > app/queries/get_messages.edgeql &&
982+
> user := (select User filter .name = <str>$username),
983+
> chat := (
984+
> select Chat filter .<chats[is User] = user and .id = <uuid>$chat_id
985+
> )
986+
> select Message {
987+
> role,
988+
> body,
989+
> sources,
990+
> chat := .<messages[is Chat]
991+
> } filter .chat = chat;
992+
' > app/queries/get_messages.edgeql &&
992993
echo 'with
993-
user := (select User filter .name = <str>$username),
994-
update Chat
995-
filter .id = <uuid>$chat_id and .<chats[is User] = user
996-
set {
997-
messages := assert_distinct(.messages union (
998-
insert Message {
999-
role := <str>$message_role,
1000-
body := <str>$message_body,
1001-
sources := array_unpack(<array<str>>$sources)
1002-
}
1003-
))
1004-
}' > app/queries/add_message.edgeql
1005-
994+
> user := (select User filter .name = <str>$username),
995+
> update Chat
996+
> filter .id = <uuid>$chat_id and .<chats[is User] = user
997+
> set {
998+
> messages := assert_distinct(.messages union (
999+
> insert Message {
1000+
> role := <str>$message_role,
1001+
> body := <str>$message_body,
1002+
> sources := array_unpack(<array<str>>$sources)
1003+
> }
1004+
> ))
1005+
> }' > app/queries/add_message.edgeql
10061006
10071007
10081008
.. edb:split-section::

0 commit comments

Comments
 (0)