Skip to content

Commit

Permalink
fix hide cot hide pp (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
willydouhard authored Jan 7, 2024
1 parent 2ccd6f9 commit 1981d2a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions backend/chainlit/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ async def get_thread(self, thread_id: str) -> "Optional[ThreadDict]":
continue
for attachment in step.attachments:
elements.append(self.attachment_to_element_dict(attachment))
if not config.features.prompt_playground and step.generation:
step.generation = None
steps.append(self.step_to_step_dict(step))

user = None # type: Optional["UserDict"]
Expand Down
4 changes: 2 additions & 2 deletions backend/chainlit/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ async def update(self):

if data_layer:
try:
asyncio.create_task(data_layer.update_step(step_dict))
asyncio.create_task(data_layer.update_step(step_dict.copy()))
except Exception as e:
if self.fail_on_persist_error:
raise e
Expand Down Expand Up @@ -313,7 +313,7 @@ async def send(self):

if data_layer:
try:
asyncio.create_task(data_layer.create_step(step_dict))
asyncio.create_task(data_layer.create_step(step_dict.copy()))
self.persisted = True
except Exception as e:
if self.fail_on_persist_error:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ const DetailsButton = ({ message, opened, onClick, loading }: Props) => {

const content = message.output;

const isRunningEmptyStep = loading && !content;
const showDefaultLoader = loading && (!content || messageContext.hideCot);

const show = tool || isRunningEmptyStep;
const hide = messageContext.hideCot && !isRunningEmptyStep;
const show = tool || showDefaultLoader;

if (!show || hide) {
if (!show) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion libs/react-components/src/playground/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function PlaygroundHeader({
<AccentButton
size="large"
target="_blank"
href="https://docs.chainlit.io/concepts/prompt-playground"
href="https://docs-prerelease.chainlit.io/advanced-features/prompt-playground"
>
Help
</AccentButton>
Expand Down

0 comments on commit 1981d2a

Please sign in to comment.