Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
975 changes: 958 additions & 17 deletions server/dataset/ai/termdb.test.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/dataset/termdb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ export default function (): Mds3 {
jsonFile: 'files/hg38/TermdbTest/trackLst/facet.json',
activeTracks: ['bw 1', 'bed 1']
},
chat: {}
chat: { aifiles: './proteinpaint/server/dataset/ai/termdb.test.json' }
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The aifiles path is ./proteinpaint/server/dataset/ai/termdb.test.json, but this repo’s file lives at server/dataset/ai/termdb.test.json. Since readJSONFile() reads paths relative to process.cwd(), running from the server/ workspace will not find ./proteinpaint/... (there is no server/proteinpaint/ dir). Update this to a path that resolves correctly from the server workspace (or make it absolute via import.meta.url).

Suggested change
chat: { aifiles: './proteinpaint/server/dataset/ai/termdb.test.json' }
chat: { aifiles: './dataset/ai/termdb.test.json' }

Copilot uses AI. Check for mistakes.
}
} satisfies Mds3
}
5 changes: 4 additions & 1 deletion server/routes/chat/DEagent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export async function extract_DE_search_terms_from_query(
const response: string = await route_to_appropriate_llm_provider(system_prompt, llm)
if (testing) {
// When testing, send raw LLM response
return { action: 'dge', response: safeParseLlmJson(response) }
const test_response = safeParseLlmJson(response)
test_response.plot = 'dge'
test_response.type = 'plot'
return test_response
} else {
// In actual production (inside PP) send LLM output for validation
return await validate_DE_response(response, ds, dataset_db_output.db_rows)
Expand Down
5 changes: 4 additions & 1 deletion server/routes/chat/matrixagent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ export async function extract_matrix_search_terms_from_query(

const response: string = await route_to_appropriate_llm_provider(system_prompt, llm)
if (testing) {
return { action: 'matrix', response: safeParseLlmJson(response) }
const test_response = safeParseLlmJson(response)
test_response.plot = 'matrix'
test_response.type = 'plot'
return test_response
} else {
return validate_matrix_response(response, common_genes, dataset_json, ds)
}
Expand Down
5 changes: 4 additions & 1 deletion server/routes/chat/samplescatteragent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ export async function extract_samplescatter_terms_from_query(

const response: string = await route_to_appropriate_llm_provider(system_prompt, llm)
if (testing) {
return { action: 'sampleScatter', response: safeParseLlmJson(response) }
const test_response = safeParseLlmJson(response)
test_response.plot = 'sampleScatter'
test_response.type = 'plot'
return test_response
} else {
return validate_samplescatter_response(response, common_genes, dataset_json, ds)
}
Expand Down
5 changes: 4 additions & 1 deletion server/routes/chat/summaryagent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ export async function extract_summary_terms(
const response: string = await route_to_appropriate_llm_provider(system_prompt, llm)
if (testing) {
// When testing, send raw LLM response
return { action: 'summary', response: safeParseLlmJson(response) }
const test_response = safeParseLlmJson(response)
test_response.plot = 'summary'
test_response.type = 'plot'
return test_response
} else {
// In actual production (inside PP) send LLM output for validation
return validate_summary_response(response, common_genes, dataset_json, ds)
Expand Down
190 changes: 0 additions & 190 deletions server/routes/chat/test/chatUnitTests.ts

This file was deleted.

34 changes: 17 additions & 17 deletions server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ export async function launch() {
setAppMiddlewares(app, genomes, doneLoading)

console.log('setting server routes ...')
const routeCallbacks = await setOptionalRoutes(app)
const routeCallbacks = await setOptionalRoutes(app, genomes)
console.log('may set auth routes ...')
/*
!!! the order of middlewares is critical, must be set before data routes !!!
- so that a request will be inspected by auth before allowing
to proceed to any *protected* route handler
*/
!!! the order of middlewares is critical, must be set before data routes !!!
- so that a request will be inspected by auth before allowing
to proceed to any *protected* route handler
*/
await authApi.maySetAuthRoutes(app, genomes, basepath, serverconfig)

const routes = await Promise.all(routeFiles)
Expand All @@ -63,11 +63,11 @@ export async function launch() {
basepath: serverconfig.basepath || '',
apiJson: path.join(__dirname, '../../public/docs/server-api.json')
/*
As an alternative to manually adding/removing imports in shared/types/src/routes,
you may temporarily uncomment below to generate runtime route checker code,
should only uncomment when a file has been added or deleted in
shared/types/src/routes and not when modified.
*/
As an alternative to manually adding/removing imports in shared/types/src/routes,
you may temporarily uncomment below to generate runtime route checker code,
should only uncomment when a file has been added or deleted in
shared/types/src/routes and not when modified.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the indentations are being removed. Make sure prettier is being used to reformat staged code, as triggered by git pre-commit or pre-push hools.

// , types: serverconfig.debugmode && {
// importDir: '../routes',
// outputFile: path.join(__dirname, '../../shared/types/src/checkers/routes.ts')
Expand Down Expand Up @@ -120,11 +120,11 @@ export async function launch() {
if (exitCode) console.error('\n!!!\n' + err + '\n\n')
else console.log('\n!!!\n' + err + '\n\n')
/*
when the app server is monitored by another process via the command line,
process.exit(1) is required to stop execution flow with `set -e`
and thereby avoid unnecessary endless restarts of an invalid server
init with bad config, data, and/or code
*/
when the app server is monitored by another process via the command line,
process.exit(1) is required to stop execution flow with `set -e`
and thereby avoid unnecessary endless restarts of an invalid server
init with bad config, data, and/or code
*/
const msg = err?.stack || err
if (serverconfig.slackWebhookUrl) {
const url = serverconfig.URL
Expand Down Expand Up @@ -225,9 +225,9 @@ async function setOptionalRoutes(app) {
if (!serverconfig.routeSetters) return
const routeCallbacks: OptionalRouteCallbacks = {}
for (const fname of serverconfig.routeSetters) {
if (fname.endsWith('.js')) {
if (fname.endsWith('.js') || fname.endsWith('.ts')) {
const _ = await import(fname)
const d = _.default(app, basepath)
const d = _.default(app, basepath, genomes)
if (d?.setCloseServer && fname.includes('coverage')) {
routeCallbacks.setCloseServer = d.setCloseServer
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/serverconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ if (serverconfig.debugmode && !serverconfig.binpath.includes('sjcrh/')) {
const routeSetters = []
const defaultDir = path.join(serverconfig.binpath, 'src/test/routes')
// will add testing routes as needed and if found, such as in dev environment
const testRouteSetters = ['gdc.js', 'specs.js', 'readme.js', 'coverage.js']
const testRouteSetters = ['gdc.js', 'specs.js', 'readme.js', 'coverage.js', 'testchat.ts']
if (serverconfig.features.sse === undefined) serverconfig.features.sse = true
if (typeof serverconfig.features.sse !== 'boolean') {
throw `serverconfig.features.sse must be either undefined or boolean`
Expand Down
Loading
Loading