MCPcopy
hub / github.com/hiyouga/LlamaFactory / append

Method append

src/llamafactory/webui/chatter.py:175–191  ·  view source on GitHub ↗

r"""Add the user input to chatbot. Inputs: infer.chatbot, infer.messages, infer.role, infer.query, infer.escape_html Output: infer.chatbot, infer.messages, infer.query

(
        chatbot: list[dict[str, str]],
        messages: list[dict[str, str]],
        role: str,
        query: str,
        escape_html: bool,
    )

Source from the content-addressed store, hash-verified

173
174 @staticmethod
175 def append(
176 chatbot: list[dict[str, str]],
177 messages: list[dict[str, str]],
178 role: str,
179 query: str,
180 escape_html: bool,
181 ) -> tuple[list[dict[str, str]], list[dict[str, str]], str]:
182 r"""Add the user input to chatbot.
183
184 Inputs: infer.chatbot, infer.messages, infer.role, infer.query, infer.escape_html
185 Output: infer.chatbot, infer.messages, infer.query
186 """
187 return (
188 chatbot + [{"role": "user", "content": _escape_html(query) if escape_html else query}],
189 messages + [{"role": role, "content": query}],
190 "",
191 )
192
193 def stream(
194 self,

Callers 15

build_checkpointFunction · 0.80
_setup_freeze_tuningFunction · 0.80
find_expanded_modulesFunction · 0.80
get_projectorsMethod · 0.80
patch_target_modulesFunction · 0.80
resize_embedding_layerFunction · 0.80
chatMethod · 0.80
run_chatFunction · 0.80
_chatMethod · 0.80
tool_formatterMethod · 0.80

Calls 1

_escape_htmlFunction · 0.85

Tested by 7

build_checkpointFunction · 0.64
mainFunction · 0.64
mainFunction · 0.64
test_attentionFunction · 0.64