From 2a8cb7fcf6941d1cb2f0eacf75fad55e4a154b44 Mon Sep 17 00:00:00 2001 From: vsakkas Date: Wed, 1 Nov 2023 22:33:43 +0200 Subject: [PATCH] Fix arguments when context is not provided (#89) --- README.md | 2 +- pyproject.toml | 2 +- sydney/sydney.py | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 35e57a8..9c07d97 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Sydney.py -[![Latest Release](https://img.shields.io/github/v/release/vsakkas/sydney.py.svg)](https://github.com/vsakkas/sydney.py/releases/tag/v0.17.0) +[![Latest Release](https://img.shields.io/github/v/release/vsakkas/sydney.py.svg)](https://github.com/vsakkas/sydney.py/releases/tag/v0.17.1) [![Python](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/) [![MIT License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/vsakkas/sydney.py/blob/master/LICENSE) diff --git a/pyproject.toml b/pyproject.toml index a71c394..e3b5480 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "sydney-py" -version = "0.17.0" +version = "0.17.1" description = "Python Client for Bing Chat, also known as Sydney." authors = ["vsakkas "] license = "MIT" diff --git a/sydney/sydney.py b/sydney/sydney.py index c8e582b..a4c6d02 100644 --- a/sydney/sydney.py +++ b/sydney/sydney.py @@ -167,14 +167,16 @@ def _build_ask_arguments( }, "tone": str(self.conversation_style.value), "conversationId": self.conversation_id, - "previousMessages": [ + "previousMessages": [ # Conditionally include this field { "author": "user", - "description": context if context else "", + "description": context, "contextType": "WebPage", "messageType": "Context", } - ], + ] + if context + else None, } ], "invocationId": str(self.invocation_id),