Fraser commited on
Commit
83f023c
·
1 Parent(s): 84e6c59
src/lib/components/PicletGenerator/PicletGenerator.svelte CHANGED
@@ -67,9 +67,21 @@
67
 
68
  console.log(`Generating text with Command client...`);
69
 
70
- // Use Command client
71
- const result = await client.predict("/chat", [prompt]);
72
- return result.data[0] || '';
 
 
 
 
 
 
 
 
 
 
 
 
73
  };
74
 
75
  let workflowState: PicletWorkflowState = $state({
 
67
 
68
  console.log(`Generating text with Command client...`);
69
 
70
+ // Command client expects a message format with text and files
71
+ // Using the generate function (fn_index based on ChatInterface)
72
+ const message = {
73
+ text: prompt,
74
+ files: [] // No images for text-only generation
75
+ };
76
+
77
+ // ChatInterface expects: message, history, max_new_tokens
78
+ const result = await client.predict("/chat", {
79
+ message: message,
80
+ history: [], // Empty history for single-turn generation
81
+ max_new_tokens: 2000 // Max from the space
82
+ });
83
+
84
+ return result.data || '';
85
  };
86
 
87
  let workflowState: PicletWorkflowState = $state({