mirror of
https://github.com/jcreek/AutomatedAssessmentFeedbackAgent.git
synced 2026-07-13 02:53:49 +00:00
fix(*): Ensure fallback data works correctly
This commit is contained in:
@@ -23,10 +23,9 @@ if (!safeModel && !isTestEnv) {
|
|||||||
throw new Error('AI_MODEL is not set');
|
throw new Error('AI_MODEL is not set');
|
||||||
}
|
}
|
||||||
|
|
||||||
export const client = AIProjectsClient.fromConnectionString(
|
export const client = !isTestEnv && safeConnString
|
||||||
safeConnString!,
|
? AIProjectsClient.fromConnectionString(safeConnString, new DefaultAzureCredential())
|
||||||
new DefaultAzureCredential()
|
: undefined;
|
||||||
);
|
|
||||||
|
|
||||||
// const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([]);
|
// const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([]);
|
||||||
|
|
||||||
@@ -71,7 +70,8 @@ export const toolResources = allTools.reduce<Record<string, any>>((map, t) => {
|
|||||||
return map;
|
return map;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
export const agent = await client.agents.createAgent(AI_MODEL, {
|
export const agent = client
|
||||||
|
? await client.agents.createAgent(AI_MODEL, {
|
||||||
name: `assessment-feedback-agent`,
|
name: `assessment-feedback-agent`,
|
||||||
instructions,
|
instructions,
|
||||||
temperature: 0.5,
|
temperature: 0.5,
|
||||||
@@ -80,4 +80,5 @@ export const agent = await client.agents.createAgent(AI_MODEL, {
|
|||||||
requestOptions: {
|
requestOptions: {
|
||||||
headers: { 'x-ms-enable-preview': 'true' }
|
headers: { 'x-ms-enable-preview': 'true' }
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
: undefined;
|
||||||
+6
-1
@@ -145,7 +145,12 @@ export async function gradeSubmissionWithAgent(
|
|||||||
task: string,
|
task: string,
|
||||||
roomId: string
|
roomId: string
|
||||||
): Promise<OpenAIResponse> {
|
): Promise<OpenAIResponse> {
|
||||||
if (!client || !agent) {
|
if (!client) {
|
||||||
|
// In test/CI mode, return fallback data
|
||||||
|
return fallbackGrade(submission, task);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!agent) {
|
||||||
throw new Error('Agent not available');
|
throw new Error('Agent not available');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user