Browse Source

Add history to the conversation

make-qwen-llm-configurable
haixuantao 5 months ago
parent
commit
91dec55e63
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      node-hub/dora-qwen/dora_qwen/main.py

+ 5
- 2
node-hub/dora-qwen/dora_qwen/main.py View File

@@ -93,12 +93,15 @@ def main():
if len(ACTIVATION_WORDS) == 0 or any(
word in ACTIVATION_WORDS for word in words
):
# On linux, Windows
history += [{"role": "user", "content": text}]

response = model.create_chat_completion(
messages=[{"role": "user", "content": text}], # Prompt
messages=history, # Prompt
max_tokens=24,
)["choices"][0]["message"]["content"]

history += [{"role": "assistant", "content": response}]

node.send_output(
output_id="text",
data=pa.array([response]),


Loading…
Cancel
Save