Skip to content

Using a front-end library for class names presence filtering #646

Description

@SantiagoDePolonia

There are some js/svelte libraries to simplify the code like this by removing repetitions and noise. In the scope of this task some research should be performed and the appropriate library introduced.

The dirty code example:

  function articleClass(m) {
    const base =
      m.role === "function_call" || m.role === "function_result"
        ? "chat-function-note"
        : "chat-message";
    return [base, m.roleClass, m.isAnchor ? "is-anchor" : "", m.isAfterAnchor ? "is-after-anchor" : ""]
      .filter(Boolean)
      .join(" ");
  }

  function functionDetailText(m) {
    if (m.role === "function_call") {
      return (m.toolCalls || []).map((tc) => tc.name + "()").join(", ");
    }
    return (m.functionName ? m.functionName + ": " : "") + m.text;
  }
</script>

<article
  class={articleClass(msg)}
...

Activity

  1. added a commit that references this issue on Aug 4, 2026
    adbbe0e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions