Command output now logged as base64 string to avoid multiline issues.

This commit is contained in:
David J. Bianco
2024-08-16 09:13:41 -04:00
parent eb4a67f094
commit c40444a6cc

View File

@ -10,6 +10,7 @@ from typing import Optional
import logging import logging
import datetime import datetime
import uuid import uuid
from base64 import b64encode
from langchain_openai import ChatOpenAI from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage from langchain_core.messages import HumanMessage
@ -41,7 +42,7 @@ async def handle_client(process: asyncssh.SSHServerProcess) -> None:
) )
process.stdout.write(f"{llm_response.content}") process.stdout.write(f"{llm_response.content}")
logger.info(f"OUTPUT: {llm_response.content}") logger.info(f"OUTPUT: {b64encode(llm_response.content.encode('ascii')).decode('ascii')}")
try: try:
async for line in process.stdin: async for line in process.stdin:
@ -63,7 +64,7 @@ async def handle_client(process: asyncssh.SSHServerProcess) -> None:
) )
process.stdout.write(f"{llm_response.content}") process.stdout.write(f"{llm_response.content}")
logger.info(f"OUTPUT: {llm_response.content}") logger.info(f"OUTPUT: {b64encode(llm_response.content.encode('ascii')).decode('ascii')}")
except asyncssh.BreakReceived: except asyncssh.BreakReceived:
pass pass