code: def decode_bytes(chunks: List[bytes]):
      """Decodes bytes to string
  
      Args:
          chunks: byte chunks
  
      Returns:
          list of decoded strings
      """
      decoded_tokens = []
      buffer = b""
  
      for chunk in chunks:
          combined = buffer + chunk
          try:
              # Try to decode the combined bytes
              decoded_tokens.append(combined.decode("utf-8"))
              # If successful, clear the buffer
              buffer = b""
          except UnicodeDecodeError:
              # If decoding failed, keep the current chunk in the buffer
              # and attempt to combine it with the next chunk
              buffer = chunk
  
      # Attempt to decode any remaining bytes in the buffer
      try:
          decoded_tokens.append(buffer.decode("utf-8"))
      except UnicodeDecodeError:
          pass
  
      return decoded_tokens
  
file_path: h2o-llmstudio/llm_studio/src/utils/plot_utils.py
imports: import html
  import re
  from dataclasses import dataclass
  from typing import List
label_desc: Use image node_id 2 for calling a global function with example usage: decode_bytes(chunks) and returns: decoded_tokens