Spaces:
Sleeping
Sleeping
Trae Assistant commited on
Commit ·
5db8244
1
Parent(s): 69a3dd3
fix: Restore API Key prompt and fix unused imports
Browse files
src/services/chatService.ts
CHANGED
|
@@ -142,8 +142,14 @@ export const chatService = {
|
|
| 142 |
},
|
| 143 |
|
| 144 |
async sendMessage(messages: Message[], onChunk: (content: string) => void, signal?: AbortSignal): Promise<void> {
|
| 145 |
-
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
try {
|
| 149 |
const response = await fetch(API_URL, {
|
|
|
|
| 142 |
},
|
| 143 |
|
| 144 |
async sendMessage(messages: Message[], onChunk: (content: string) => void, signal?: AbortSignal): Promise<void> {
|
| 145 |
+
let apiKey = this.getApiKey();
|
| 146 |
+
if (!apiKey) {
|
| 147 |
+
const input = prompt('Please enter your SiliconFlow API Key:');
|
| 148 |
+
if (input) {
|
| 149 |
+
this.setApiKey(input);
|
| 150 |
+
apiKey = input;
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
|
| 154 |
try {
|
| 155 |
const response = await fetch(API_URL, {
|