Skip to content

Commit d0cef3a

Browse files
committed
Added debug statments, tried giving more time to jest tests when more prompts were added but test still failed
1 parent b9be65f commit d0cef3a

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

server/src/gpt-controller.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ export class GPTController {
6767
for (const message of messages.data.reverse()) {
6868
if (message.content[0].type == "text") { // Need to check if the message content is text before parsing it
6969
var result = message.content[0].text.value;
70+
//console.log("Result: ", result) // FOR DEBUGGING
7071
if(n % 2 == 0) { // Every second message has the data values
71-
// console.log(`${message.role} > ${result}`); // FOR TESTING
72+
// console.log(`${message.role} > ${result}`); // FOR DEBUGGING
7273
let preres = result.split("ø").map((s) => s.replace("\n", "") && s.replace(/^\s+/g, "")); // Trimming each string
73-
console.log(preres)
74+
console.log("After split: ", preres)
7475
var resvalues: GPTData = {
7576
paper_name: preres[0],
7677
year: parseInt(preres[1]),
@@ -81,8 +82,8 @@ export class GPTController {
8182
testing_location: <TestLocation>preres[6],
8283
testing_type: <Testing>preres[7],
8384
// TODO: preres[7] is a list ("TID, TID, DD") if the paper has more than one testing type, so the cast may fail
84-
// Produces weird output: "SEE【4:0†source】"
85-
data_type: 0 // TODO: add a prompt to get number data_type. What is it?
85+
// Produces weird output: "SEE【4:0†source】"
86+
data_type: 0 // TODO: Need to be removed hear, from the defined data types and in db controller
8687
};
8788
console.log(resvalues)
8889
threadResults.push(resvalues);
@@ -108,6 +109,7 @@ export class GPTController {
108109
});
109110

110111
await Promise.all(fileThreads);
112+
console.log("All threads completed!");
111113
return results;
112114
}
113115

server/src/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ initializeSystem().then(({dbController, gptController}) => {
5050
//app.use("/getTable", tableRouter)
5151
app.use("/api/dataRequest", cascadeRouter(dbController));
5252
app.use("/api/adminRequest", adminRouter(dbController, gptController));
53+
//FOR QUICKLY TESTING A PAPER: Uncomment paper to test it. Run "localhost:3000/parse" in a browser to parse the paper and see results in console
54+
// app.use("/parse", () => {
55+
// gptController.runGPTAnalysis(["./test/testfiles/SEE_in-flight_data_for_two_static_32KB_memories_on_high_earth_orbit.pdf"]);
56+
// // gptController.runGPTAnalysis(["./test/testfiles/A_radiation_tolerant_video_camera_for_high_total_dose_environments.pdf"]);
57+
// // gptController.runGPTAnalysis(["./test/testfiles/Radiation_effects_predicted_observed_and_compared_for_spacecraft_systems.pdf"]);
58+
// // gptController.runGPTAnalysis(["./test/testfiles/Solar_flare_proton_environment_for_estimating_downtime_of_spacecraft_CCDs.pdf"]);
59+
// // gptController.runGPTAnalysis(["./test/testfiles/slvk121.pdf"]);
60+
// });
5361

5462
app.listen(PORT, () => {
5563
console.log(`Server is running on ${PORT}`);

server/src/prompts.data.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ export const questions = [
88
"What is the type of testing location: Respond to this question with \"Terrestrial\" for a terrestial testing location, or \"Flight\" for a flight testing location",
99
"What type of testing was done: Respond to this question with \"TID\" for Total Ionizing Dose testing, \"SEE\" for heavy ion, proton, laser, or neutron testing, \"DD\" for displacement damage testing, or \"OTHER\" if you are not completely 100% sure",
1010
// In-progress prompts, bad results
11-
// "If Total Ionizing Dose testing was performed, then list which of the following tests were done in a \"¶\" separated list: Co60, ELDRS, Protons, Electrons. Otherwise, reply N/A",
12-
// "If single event effects testing using heavy ion, proton, laser, or neutron was done, then list which of the following tests were done in a \"¶\" separated list: Reply SEU for single event upset, SET for single event transient, SEFI for single event functional interrupt, SEL for single event latchup, SEB for single event burnout, SEGR for gate rupture, Dose rate for dose rate. Otherwise, reply N/A",
13-
// "If displacement damage testing was performed, then list which of the following tests were conducted in a \"¶\" separated list: Reply \"Protons\" for proton damage, \"Neutrons\" for neutron damage. Otherwise, reply N/A",
11+
// "If Total Ionizing Dose testing was performed, then list which of the following tests were done: Co60, ELDRS, Protons, Electrons. Otherwise, reply N/A",
12+
// "If single event effects testing using heavy ion, proton, laser, or neutron was done, then list which of the following tests were done: Reply SEU for single event upset, SET for single event transient, SEFI for single event functional interrupt, SEL for single event latchup, SEB for single event burnout, SEGR for gate rupture, Dose rate for dose rate. Otherwise, reply N/A",
13+
// "If displacement damage testing was performed, then list which of the following tests were conducted: Reply \"Protons\" for proton damage, \"Neutrons\" for neutron damage. Otherwise, reply N/A",
1414

1515
"Summarize the paper's test results in 3 lines",
1616
// "Reference the page number for each answer for the above questions in a \"¶\" separated list. If you are unable to give a page number or the answer is N/A, provide the answer N/A"
@@ -21,6 +21,7 @@ export const prompt = `Please answer the following questions, as concisely as po
2121
If you are unable to answer the question accurately, provide the answer N/A.
2222
Answer each question, and separate the answers with a "ø" character as a delimiter.\n`;
2323

24+
// TODO: Need to incorporate the 3 sets of questions below, into prompts
2425
export const Other_targeted_questions = [
2526
"What type was the radiation source",
2627
"Were there any failures, if so, when?",

server/test/gpt-controller.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ test("Insertion of a paper with one author", async () => {
4040

4141
// await expect(testGPT.runGPTAnalysis([paper])).resolves.not.toThrow();
4242
// }, 60000);
43+
// }, 90000); // More prompts = more time. Still not enough time... TODO: fix the test
4344

4445
// Below gpt tests commented out to reduce token usage during testing
4546

0 commit comments

Comments
 (0)