quanliang Claude Opus 5 (1M context) commited on
Commit
4c873b4
Β·
1 Parent(s): 3b8ddf9

Add per-mode Information modal; keep context in design goals

Browse files

Information button and modal in the app header for QA, System Chart
Extraction, and Hypotheses Generation, mirroring the one PlotExtract
has on madtools.org. Each mode gets its own "what this tool does /
when to use it / instructions" panel. All markup, styles, and script
are scoped to html[data-mode] for the three modes, so the landing
page and the PlotExtract app are unaffected.

Design-goals analysis now carries the material system and operating
environment into both suggested properties. Those two strings are the
only channel from the researcher's description into the hypotheses
prompt, so context such as "high entropy alloys" or "under cryogenic
temperature" was previously dropped for the rest of the pipeline.

Also shortens the per-mode footer disclaimers.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Files changed (2) hide show
  1. index.html +320 -10
  2. prompts.py +15 -4
index.html CHANGED
@@ -2833,6 +2833,196 @@
2833
  display: block;
2834
  }
2835
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2836
  </style>
2837
  </head>
2838
  <body>
@@ -2862,6 +3052,7 @@
2862
  <div id="app">
2863
  <!-- Header β€” PlotExtract-style brand/hero -->
2864
  <header class="app-header">
 
2865
  <div class="brand">
2866
  <span id="appTitle">Chatbot</span>
2867
  </div>
@@ -3088,30 +3279,149 @@
3088
  <footer class="mode-footer footer" id="qaFooter">
3089
  <p>
3090
  This tool lets you upload research papers and ask questions about them; answers are grounded
3091
- in the content of your uploaded documents. It works best with clear, specific questions about
3092
- machine-readable PDFs. Because answers are generated by LLMs, they can contain mistakes or
3093
- omissions and are not guaranteed to be correct. Always verify important information against
3094
- the original papers before using it for analysis, reporting, or decision-making.
3095
  </p>
3096
  </footer>
3097
  <footer class="mode-footer footer" id="systemChartFooter">
3098
  <p>
3099
  This tool automatically extracts materials system charts, the relationships linking
3100
- processing, structure, and properties, from uploaded research papers. Because extraction relies on LLMs, results can contain mistakes, omissions, or formatting issues and are not guaranteed to be correct. Always review and verify the extracted
3101
- charts against the original papers before using them for analysis or reporting.
3102
  </p>
3103
  </footer>
3104
  <footer class="mode-footer footer" id="hypothesesFooter">
3105
  <p>
3106
- This tool generates materials design hypotheses by synergistically combining materials system charts, guided by design goals. Generated hypotheses are produced by LLMs and are not guaranteed to be
3107
- scientifically valid or novel, so please take the
3108
- results with caution. Always apply domain expertise and verify against the literature before acting
3109
- on any hypothesis.
3110
  </p>
3111
  </footer>
3112
 
3113
  </div>
3114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3115
  <button id="adminFab" type="button" title="Owner admin controls">Admin</button>
3116
  <div id="adminPanel" role="dialog" aria-modal="false" aria-label="Admin panel">
3117
  <h4>Owner Admin</h4>
 
2833
  display: block;
2834
  }
2835
 
2836
+ /* ============================================================
2837
+ Per-mode "Information" button + modal.
2838
+ Owned by QA / System Chart Extraction / Hypotheses Generation.
2839
+ Everything here is scoped to those three modes, so it never
2840
+ applies to the landing page or to the PlotExtract app.
2841
+ ============================================================ */
2842
+
2843
+ /* Hidden unless one of the three owned modes is active. */
2844
+ #infoOpenBtn,
2845
+ #infoModalBackdrop {
2846
+ display: none;
2847
+ }
2848
+
2849
+ html[data-mode="QA"] .app-header,
2850
+ html[data-mode="System Chart Extraction"] .app-header,
2851
+ html[data-mode="Hypotheses Generation"] .app-header {
2852
+ position: relative;
2853
+ padding-right: 150px;
2854
+ }
2855
+
2856
+ html[data-mode="QA"] #infoOpenBtn,
2857
+ html[data-mode="System Chart Extraction"] #infoOpenBtn,
2858
+ html[data-mode="Hypotheses Generation"] #infoOpenBtn {
2859
+ display: inline-block;
2860
+ position: absolute;
2861
+ top: 0;
2862
+ right: 0;
2863
+ background: transparent;
2864
+ border: 1px solid var(--border);
2865
+ color: var(--text);
2866
+ font-family: var(--font-body);
2867
+ font-size: 0.95rem;
2868
+ font-weight: 500;
2869
+ padding: 10px 22px;
2870
+ border-radius: 12px;
2871
+ cursor: pointer;
2872
+ white-space: nowrap;
2873
+ transition: border-color 0.2s ease, color 0.2s ease;
2874
+ }
2875
+
2876
+ html[data-mode="QA"] #infoOpenBtn:hover,
2877
+ html[data-mode="System Chart Extraction"] #infoOpenBtn:hover,
2878
+ html[data-mode="Hypotheses Generation"] #infoOpenBtn:hover {
2879
+ border-color: var(--accent-2);
2880
+ color: var(--accent-2);
2881
+ }
2882
+
2883
+ html[data-mode="QA"] #infoModalBackdrop.is-open,
2884
+ html[data-mode="System Chart Extraction"] #infoModalBackdrop.is-open,
2885
+ html[data-mode="Hypotheses Generation"] #infoModalBackdrop.is-open {
2886
+ display: flex;
2887
+ position: fixed;
2888
+ inset: 0;
2889
+ z-index: 1000;
2890
+ align-items: center;
2891
+ justify-content: center;
2892
+ padding: 2rem 1rem;
2893
+ background: rgba(2, 6, 23, 0.72);
2894
+ backdrop-filter: blur(4px);
2895
+ }
2896
+
2897
+ html[data-mode="QA"] .info-modal,
2898
+ html[data-mode="System Chart Extraction"] .info-modal,
2899
+ html[data-mode="Hypotheses Generation"] .info-modal {
2900
+ position: relative;
2901
+ width: 100%;
2902
+ max-width: 720px;
2903
+ max-height: 85vh;
2904
+ overflow-y: auto;
2905
+ padding: 1.75rem 2rem 2rem;
2906
+ background: var(--surface-strong);
2907
+ border: 1px solid var(--border);
2908
+ border-radius: var(--radius-lg);
2909
+ box-shadow: var(--shadow-md);
2910
+ color: var(--text);
2911
+ text-align: left;
2912
+ }
2913
+
2914
+ html[data-mode="QA"] .info-modal-head,
2915
+ html[data-mode="System Chart Extraction"] .info-modal-head,
2916
+ html[data-mode="Hypotheses Generation"] .info-modal-head {
2917
+ display: flex;
2918
+ align-items: center;
2919
+ justify-content: space-between;
2920
+ gap: 1rem;
2921
+ margin-bottom: 1.25rem;
2922
+ }
2923
+
2924
+ html[data-mode="QA"] .info-modal-head h2,
2925
+ html[data-mode="System Chart Extraction"] .info-modal-head h2,
2926
+ html[data-mode="Hypotheses Generation"] .info-modal-head h2 {
2927
+ margin: 0;
2928
+ font-family: var(--font-display);
2929
+ font-size: 1.6rem;
2930
+ font-weight: 600;
2931
+ color: var(--text);
2932
+ }
2933
+
2934
+ html[data-mode="QA"] #infoCloseBtn,
2935
+ html[data-mode="System Chart Extraction"] #infoCloseBtn,
2936
+ html[data-mode="Hypotheses Generation"] #infoCloseBtn {
2937
+ background: transparent;
2938
+ border: 1px solid var(--border);
2939
+ color: var(--text);
2940
+ font-family: var(--font-body);
2941
+ font-size: 0.9rem;
2942
+ padding: 8px 18px;
2943
+ border-radius: 12px;
2944
+ cursor: pointer;
2945
+ white-space: nowrap;
2946
+ transition: border-color 0.2s ease, color 0.2s ease;
2947
+ }
2948
+
2949
+ html[data-mode="QA"] #infoCloseBtn:hover,
2950
+ html[data-mode="System Chart Extraction"] #infoCloseBtn:hover,
2951
+ html[data-mode="Hypotheses Generation"] #infoCloseBtn:hover {
2952
+ border-color: var(--accent-2);
2953
+ color: var(--accent-2);
2954
+ }
2955
+
2956
+ /* Only the panel matching the active mode is shown. */
2957
+ .info-modal-body { display: none; }
2958
+ html[data-mode="QA"] #infoBodyQA,
2959
+ html[data-mode="System Chart Extraction"] #infoBodyChart,
2960
+ html[data-mode="Hypotheses Generation"] #infoBodyHypotheses {
2961
+ display: block;
2962
+ }
2963
+
2964
+ html[data-mode="QA"] .info-modal-body h3,
2965
+ html[data-mode="System Chart Extraction"] .info-modal-body h3,
2966
+ html[data-mode="Hypotheses Generation"] .info-modal-body h3 {
2967
+ margin: 1.35rem 0 0.45rem;
2968
+ font-family: var(--font-display);
2969
+ font-size: 1.05rem;
2970
+ font-weight: 600;
2971
+ color: var(--text);
2972
+ }
2973
+
2974
+ html[data-mode="QA"] .info-modal-body h3:first-child,
2975
+ html[data-mode="System Chart Extraction"] .info-modal-body h3:first-child,
2976
+ html[data-mode="Hypotheses Generation"] .info-modal-body h3:first-child {
2977
+ margin-top: 0;
2978
+ }
2979
+
2980
+ html[data-mode="QA"] .info-modal-body p,
2981
+ html[data-mode="System Chart Extraction"] .info-modal-body p,
2982
+ html[data-mode="Hypotheses Generation"] .info-modal-body p,
2983
+ html[data-mode="QA"] .info-modal-body li,
2984
+ html[data-mode="System Chart Extraction"] .info-modal-body li,
2985
+ html[data-mode="Hypotheses Generation"] .info-modal-body li {
2986
+ color: var(--muted);
2987
+ font-size: 0.95rem;
2988
+ line-height: 1.65;
2989
+ }
2990
+
2991
+ html[data-mode="QA"] .info-modal-body ol,
2992
+ html[data-mode="System Chart Extraction"] .info-modal-body ol,
2993
+ html[data-mode="Hypotheses Generation"] .info-modal-body ol {
2994
+ margin: 0;
2995
+ padding-left: 1.5rem;
2996
+ }
2997
+
2998
+ html[data-mode="QA"] .info-modal-body li,
2999
+ html[data-mode="System Chart Extraction"] .info-modal-body li,
3000
+ html[data-mode="Hypotheses Generation"] .info-modal-body li {
3001
+ margin-bottom: 0.3rem;
3002
+ }
3003
+
3004
+ html[data-mode="QA"] .info-modal-body strong,
3005
+ html[data-mode="System Chart Extraction"] .info-modal-body strong,
3006
+ html[data-mode="Hypotheses Generation"] .info-modal-body strong {
3007
+ color: var(--text);
3008
+ font-weight: 600;
3009
+ }
3010
+
3011
+ @media (max-width: 640px) {
3012
+ html[data-mode="QA"] .app-header,
3013
+ html[data-mode="System Chart Extraction"] .app-header,
3014
+ html[data-mode="Hypotheses Generation"] .app-header {
3015
+ padding-right: 0;
3016
+ }
3017
+
3018
+ html[data-mode="QA"] #infoOpenBtn,
3019
+ html[data-mode="System Chart Extraction"] #infoOpenBtn,
3020
+ html[data-mode="Hypotheses Generation"] #infoOpenBtn {
3021
+ position: static;
3022
+ margin-bottom: 0.9rem;
3023
+ }
3024
+ }
3025
+
3026
  </style>
3027
  </head>
3028
  <body>
 
3052
  <div id="app">
3053
  <!-- Header β€” PlotExtract-style brand/hero -->
3054
  <header class="app-header">
3055
+ <button type="button" id="infoOpenBtn" aria-haspopup="dialog">Information</button>
3056
  <div class="brand">
3057
  <span id="appTitle">Chatbot</span>
3058
  </div>
 
3279
  <footer class="mode-footer footer" id="qaFooter">
3280
  <p>
3281
  This tool lets you upload research papers and ask questions about them; answers are grounded
3282
+ in the content of your uploaded documents. Always review and verify results before using them
3283
+ for analysis, reporting, or decision-making.
 
 
3284
  </p>
3285
  </footer>
3286
  <footer class="mode-footer footer" id="systemChartFooter">
3287
  <p>
3288
  This tool automatically extracts materials system charts, the relationships linking
3289
+ processing, structure, and properties, from uploaded research papers. Always review and verify
3290
+ results before using them for analysis, reporting, or decision-making.
3291
  </p>
3292
  </footer>
3293
  <footer class="mode-footer footer" id="hypothesesFooter">
3294
  <p>
3295
+ This tool generates materials design hypotheses by combining mechanisms drawn from different
3296
+ materials system charts, creating interdependence between them under a specified design goal.
3297
+ Always review and verify results before using them for analysis, reporting, or decision-making.
 
3298
  </p>
3299
  </footer>
3300
 
3301
  </div>
3302
 
3303
+ <!-- ============================================================
3304
+ Per-mode Information modal (QA / System Chart Extraction /
3305
+ Hypotheses Generation). Kept at body level so it is never
3306
+ clipped by #app, and shown only for the three owned modes.
3307
+ ============================================================ -->
3308
+ <div id="infoModalBackdrop">
3309
+ <div class="info-modal" role="dialog" aria-modal="true" aria-labelledby="infoModalTitle">
3310
+ <div class="info-modal-head">
3311
+ <h2 id="infoModalTitle">Information</h2>
3312
+ <button type="button" id="infoCloseBtn">Close</button>
3313
+ </div>
3314
+
3315
+ <div class="info-modal-body" id="infoBodyQA">
3316
+ <h3>What this tool does</h3>
3317
+ <p>
3318
+ QA turns your uploaded papers into a searchable database, finds the passages most
3319
+ relevant to your question, and answers you.
3320
+ </p>
3321
+
3322
+ <h3>When to use it</h3>
3323
+ <p>
3324
+ Use it when you want answers grounded in a specific set of documents.
3325
+ </p>
3326
+
3327
+ <h3>Instructions</h3>
3328
+ <ol>
3329
+ <li>Enter an OpenAI or Google Gemini API key, choose a model, and click Confirm.</li>
3330
+ <li>Name your database, upload your PDF, TXT, or image files, and click Upload. For more than 1000 files, upload a ZIP instead.</li>
3331
+ <li>Wait for the upload and embedding progress to finish.</li>
3332
+ <li>Select one or more databases to search β€” hold Ctrl/Cmd to select several.</li>
3333
+ <li>Type your question and click Ask.</li>
3334
+ </ol>
3335
+ </div>
3336
+
3337
+ <div class="info-modal-body" id="infoBodyChart">
3338
+ <h3>What this tool does</h3>
3339
+ <p>
3340
+ System Chart Extraction reads each uploaded paper in full and extracts its materials
3341
+ system chart β€” the reported links between processing, structure, properties, and
3342
+ performance β€” along with the supporting citations from that paper.
3343
+ </p>
3344
+
3345
+ <h3>When to use it</h3>
3346
+ <p>
3347
+ Use it when you want structured system charts across a set of papers,
3348
+ or when you need <strong>system_charts.txt</strong> files as input for Hypotheses Generation.
3349
+ </p>
3350
+
3351
+ <h3>Instructions</h3>
3352
+ <ol>
3353
+ <li>Enter an OpenAI or Google Gemini API key, choose a model, and click Confirm.</li>
3354
+ <li>Name your database, upload the papers you want to analyze, and click Upload.</li>
3355
+ <li>Select the database(s) to process. Tick <strong>Enable visualization</strong> if you also want the extracted charts drawn.</li>
3356
+ <li>Click Confirm and wait β€” papers are processed one at a time and progress is shown.</li>
3357
+ <li>Download the ZIP. It contains <strong>system_charts.txt</strong> (the charts) and <strong>all_details.txt</strong> (the full analysis).</li>
3358
+ <li>Optionally use <strong>Continue System Chart Extraction Conversations</strong> to ask follow-up questions about an individual paper.</li>
3359
+ </ol>
3360
+ </div>
3361
+
3362
+ <div class="info-modal-body" id="infoBodyHypotheses">
3363
+ <h3>What this tool does</h3>
3364
+ <p>
3365
+ Hypotheses Generation combines mechanisms drawn from different materials system charts
3366
+ and proposes design hypotheses that make those mechanisms interdependent under the
3367
+ design goal you specify.
3368
+ </p>
3369
+
3370
+ <h3>When to use it</h3>
3371
+ <p>
3372
+ Use it once you have system charts from at least two papers and a materials design goal
3373
+ in mind β€” for example, when looking for non-obvious ways to combine mechanisms that were
3374
+ reported in separate studies.
3375
+ </p>
3376
+
3377
+ <h3>Instructions</h3>
3378
+ <ol>
3379
+ <li>Enter an OpenAI or Google Gemini API key, choose a model, and click Confirm.</li>
3380
+ <li>Upload one or more <strong>system_charts.txt</strong> files from System Chart Extraction β€” not all_details.txt. Together they must contain at least two system charts.</li>
3381
+ <li>Describe your materials design goals in plain language, then click <strong>Analyze design goals</strong>.</li>
3382
+ <li>Review and edit the two suggested design properties, and set the number of iterations (1–100).</li>
3383
+ <li>Click Confirm and wait, then download the ZIP containing <strong>hypotheses.txt</strong>.</li>
3384
+ <li>Optionally use <strong>Continue Hypothesis Analysis</strong> to paste a hypothesis plus paper content and explore it further.</li>
3385
+ </ol>
3386
+ </div>
3387
+ </div>
3388
+ </div>
3389
+
3390
+ <script>
3391
+ // Information modal for QA / System Chart Extraction / Hypotheses Generation.
3392
+ // Self-contained: the correct panel is picked by CSS from html[data-mode].
3393
+ (function () {
3394
+ document.addEventListener('DOMContentLoaded', function () {
3395
+ const openBtn = document.getElementById('infoOpenBtn');
3396
+ const closeBtn = document.getElementById('infoCloseBtn');
3397
+ const backdrop = document.getElementById('infoModalBackdrop');
3398
+ if (!openBtn || !closeBtn || !backdrop) return;
3399
+
3400
+ function openInfo() {
3401
+ backdrop.classList.add('is-open');
3402
+ closeBtn.focus();
3403
+ }
3404
+
3405
+ function closeInfo() {
3406
+ backdrop.classList.remove('is-open');
3407
+ openBtn.focus();
3408
+ }
3409
+
3410
+ openBtn.addEventListener('click', openInfo);
3411
+ closeBtn.addEventListener('click', closeInfo);
3412
+
3413
+ // Click outside the panel closes it.
3414
+ backdrop.addEventListener('click', function (event) {
3415
+ if (event.target === backdrop) closeInfo();
3416
+ });
3417
+
3418
+ document.addEventListener('keydown', function (event) {
3419
+ if (event.key === 'Escape' && backdrop.classList.contains('is-open')) closeInfo();
3420
+ });
3421
+ });
3422
+ })();
3423
+ </script>
3424
+
3425
  <button id="adminFab" type="button" title="Owner admin controls">Admin</button>
3426
  <div id="adminPanel" role="dialog" aria-modal="false" aria-label="Admin panel">
3427
  <h4>Owner Admin</h4>
prompts.py CHANGED
@@ -217,6 +217,12 @@ def create_design_goals_analysis_prompt(description):
217
  ideal properties, constraints, target application). This prompt asks the model to
218
  distill that into exactly two distinct target properties/mechanisms that the
219
  hypothesis generation should target simultaneously.
 
 
 
 
 
 
220
  """
221
  return f'''You are assisting a materials scientist who is setting up a materials-design hypothesis generation task. The task requires exactly TWO target material properties (or performance goals) that the design must achieve simultaneously, since the tool works by finding synergistic combinations between two objectives that are often in tension (a trade-off).
222
 
@@ -228,10 +234,15 @@ From this description, identify the TWO most important, distinct target material
228
 
229
  Rules:
230
  1. Return exactly two properties.
231
- 2. Each property must be a concise noun phrase (typically 2-6 words), e.g. "High tensile strength", "Good ductility", "High ionic conductivity", "Low thermal expansion".
232
- 3. The two properties must be distinct and non-overlapping. When the description implies a trade-off (e.g. strength vs. ductility), the two properties should reflect the two competing sides.
233
- 4. Prefer properties explicitly mentioned by the researcher. Only infer a property if the description clearly implies it.
234
- 5. Do not add explanations, units, target values, material names, or any extra text.
 
 
 
 
 
235
 
236
  Respond STRICTLY in the following format and output nothing else:
237
  Property 1: <first property>
 
217
  ideal properties, constraints, target application). This prompt asks the model to
218
  distill that into exactly two distinct target properties/mechanisms that the
219
  hypothesis generation should target simultaneously.
220
+
221
+ Each returned property also carries the material system and operating environment
222
+ when the researcher states them. These two strings are the only channel from the
223
+ researcher's description into create_hypotheses_generation_prompt(), so context
224
+ dropped here (e.g. "high entropy alloys", "at cryogenic temperature") is lost for
225
+ the rest of the pipeline.
226
  """
227
  return f'''You are assisting a materials scientist who is setting up a materials-design hypothesis generation task. The task requires exactly TWO target material properties (or performance goals) that the design must achieve simultaneously, since the tool works by finding synergistic combinations between two objectives that are often in tension (a trade-off).
228
 
 
234
 
235
  Rules:
236
  1. Return exactly two properties.
237
+ 2. Each property must be a concise noun phrase naming the target property (typically 2-6 words), e.g. "High tensile strength", "Good ductility", "High ionic conductivity", "Low thermal expansion".
238
+ 3. If the researcher names a material system (e.g. "high entropy alloys", "solid electrolytes") and/or an operating environment or condition (e.g. "under cryogenic temperature", "at high pressure", "in seawater"), append that context to BOTH properties so each one reads as a complete design target. For example, "For high entropy alloys, I want both high strength and good ductility under cryogenic temperature" becomes:
239
+ Property 1: High strength in high entropy alloys under cryogenic temperature
240
+ Property 2: Good ductility in high entropy alloys under cryogenic temperature
241
+ Both properties must carry the SAME material system and environment; only the property itself differs. Keep each line under about 15 words.
242
+ 4. If the researcher names neither a material system nor an operating environment, return the bare property phrase alone.
243
+ 5. The two properties must be distinct and non-overlapping. When the description implies a trade-off (e.g. strength vs. ductility), the two properties should reflect the two competing sides.
244
+ 6. Prefer properties explicitly mentioned by the researcher. Only infer a property if the description clearly implies it.
245
+ 7. Do not add explanations, units, target values, or any text beyond the property, material system, and operating environment.
246
 
247
  Respond STRICTLY in the following format and output nothing else:
248
  Property 1: <first property>