You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constsystemPrompt=`You are a helpful assistant that answers questions about Sim Studio documentation.
119
134
120
-
IMPORTANT: Use inline citations throughout your response. When referencing information from the sources, include the citation number in square brackets like [1], [2], etc.
135
+
IMPORTANT: Use inline citations strategically and sparingly. When referencing information from the sources, include the citation number in curly braces like {cite:1}, {cite:2}, etc.
121
136
122
-
Guidelines:
137
+
Citation Guidelines:
138
+
- Cite each source only ONCE at the specific header or topic that relates to that source
139
+
- Do NOT repeatedly cite the same source throughout your response
140
+
- Place citations directly after the header or concept that the source specifically addresses
141
+
- If multiple sources support the same specific topic, cite them together like {cite:1}{cite:2}{cite:3}
142
+
- Each citation should be placed at the relevant header/topic it supports, not grouped at the beginning
143
+
- Avoid cluttering the text with excessive citations
144
+
145
+
Content Guidelines:
123
146
- Answer the user's question accurately using the provided documentation
124
-
- Include inline citations [1], [2], etc. when referencing specific information
125
-
- Use multiple citations for comprehensive answers
126
147
- Format your response in clean, readable markdown
127
148
- Use bullet points, code blocks, and headers where appropriate
128
-
- If information spans multiple sources, cite all relevant ones
129
149
- If the question cannot be answered from the context, say so clearly
130
150
- Be conversational but precise
131
151
- NEVER include object representations like "[object Object]" - always use proper text
@@ -162,33 +182,33 @@ ${context}`
162
182
if(responseinstanceofReadableStream){
163
183
if(stream){
164
184
returnresponse// Return the stream directly for streaming requests
165
-
}else{
166
-
thrownewError('Unexpected streaming response when non-streaming was requested')
167
185
}
186
+
thrownewError('Unexpected streaming response when non-streaming was requested')
168
187
}
169
188
170
189
if('stream'inresponse&&'execution'inresponse){
171
190
// Handle StreamingExecution for providers like Anthropic
172
191
if(stream){
173
192
returnresponse.stream// Return the stream from StreamingExecution
174
-
}else{
175
-
thrownewError('Unexpected streaming execution response when non-streaming was requested')
176
193
}
194
+
thrownewError('Unexpected streaming execution response when non-streaming was requested')
177
195
}
178
196
179
197
// At this point, we have a ProviderResponse
180
198
constcontent=response.content||'Sorry, I could not generate a response.'
returnNextResponse.json({error: 'Failed to generate query embedding'},{status: 500})
221
241
}
222
242
223
243
// Step 2: Search for relevant docs chunks
@@ -227,14 +247,18 @@ export async function POST(req: NextRequest) {
227
247
if(chunks.length===0){
228
248
returnNextResponse.json({
229
249
success: true,
230
-
response: "I couldn't find any relevant documentation for your question. Please try rephrasing your query or check if you're asking about a feature that exists in Sim Studio.",
250
+
response:
251
+
"I couldn't find any relevant documentation for your question. Please try rephrasing your query or check if you're asking about a feature that exists in Sim Studio.",
0 commit comments