Lucas ARRIESSE commited on
Commit ·
4633840
1
Parent(s): 595613d
Add support for a smaller model for fast tasks
Browse filesFiles changed (5)
- static/index.html+79-53
- static/js/app.js+2-1
- static/js/gen.js+11-11
- static/js/persistence.js+1-1
- static/js/ui.js+24-15
425 unmodified lines426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492425 unmodified lines<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button></form></div><h2 class="text-lg font-bold">Private generation settings</h2><p class="py-4">Detail your private LLM credentials under to draft and generate solution usingprivateLLM</p><div class="space-y-4"><div><label for="provider-url" class="block mb-2 text-sm font-medium">LLM provider URL</label><input id="settings-provider-url" name="provider-url" class="input input-bordered w-full"></div><div><label for="provider-token" class="block mb-2 text-sm font-medium">LLM providertoken</label><input id="settings-provider-token" name="provider-token"class="input input-bordered w-full" type="password"></div><div><label for="provider-model" class="block mb-2 text-sm font-medium">Model</label><button id="settings-fetch-models" class="btn btn-outline">Fetch models</button><select id="settings-provider-model" name="provider-model" class="select"></select></div><div><label for="assessment-rules" class="block mb-2 text-sm font-medium">Assessmentrules</label><textarea id="settings-assessment-rules" name="assessment-rules"class="textarea textarea-bordered w-full h-48"placeholder="Enter your rules here..."></textarea></div><div><label for="portfolio-info" class="block mb-2 text-sm font-medium">Portfolioinformation</label><textarea id="settings-portfolio" name="portfolio-info"class="textarea textarea-bordered w-full h-48"placeholder="Enter your portfolio info here..."></textarea></div><h2 class="text-lg font-bold">FTO analysis</h2><p class="py-4">Configure the max numbers of topics explored in the FTO analysis.</p><div class="w-full max-w-xs"><label for="settings-fto-topic-count">Number of topics to explore for FTO</label><input id="settings-fto-topic-count" name="settings-fto-topic-count" type="range" min="1"max="10" value="4" class="range" step="1" /><!--c moche mais ca marche--><div class="flex justify-between px-2.5 mt-2 text-xs"><span>|</span><span></span><span>|</span><span></span><span></span><span>|</span></div><div class="flex justify-between px-2.5 mt-2 text-xs"><span>1</span><span></span><span>5</span><span></span><span></span><span>10</span></div></div><p class="py-4">⚠ 'Save configuration' to keep the current configuration across sessions.</p>425 unmodified lines426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518425 unmodified lines<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button></form></div><!--LLM api settings--><div class="space-y-4"><div class="space-y-2"><h2 class="text-lg font-bold">LLM API access settings</h2><p class="font-s">Detail your LLM credentials under to draft and generate solutions usingtheprovided private LLM served over a OpenAI-like API</p><div class="space-y-4"><div><label for="provider-url" class="block mb-2 text-sm font-medium">LLM provider URL(without last leading /)</label><input id="settings-provider-url" name="provider-url"class="input input-bordered w-full"></div><div><label for="provider-token" class="block mb-2 text-sm font-medium">LLM providertoken</label><input id="settings-provider-token" name="provider-token"class="input input-bordered w-full" type="password"></div></div></div><!--LLM model selection for each task--><div class="space-y-2"><h3 class="text-m font-bold">Model selection</h3><p class="font-s">Select the models to use for solution evaluation, refinement andsummarization.</p><button id="settings-fetch-models" class="btn btn-outline">Fetch models</button><div><label for="reasoning-model-selection" class="block mb-2 text-sm font-medium">Model forreasoning tasks (evaluation, assessment)</label><select id="settings-reasoning-model" name="reasoning-model-selection" class="select"></select></div><div><label for="fast-model-selection" class="block mb-2 text-sm font-medium">Model for fast,simple tasks (summarizing, structured output)</label><select id="settings-fast-model" name="fast-model-selection" class="select"></select></div></div><!--Solution assessment settings--><div class="space-y-2"><h3 class="text-m font-bold">Solution assessment settings</h3><div><label for="assessment-rules" class="block mb-2 text-sm font-medium">Assessmentrules</label><textarea id="settings-assessment-rules" name="assessment-rules"class="textarea textarea-bordered w-full h-48"placeholder="Enter your rules here..."></textarea></div><div><label for="portfolio-info" class="block mb-2 text-sm font-medium">Portfolioinformation</label><textarea id="settings-portfolio" name="portfolio-info"class="textarea textarea-bordered w-full h-48"placeholder="Enter your portfolio info here..."></textarea></div></div><div class="space-y-2"><h2 class="text-m font-bold">FTO analysis</h2><p class="text-s">Configure the max numbers of topics explored in the FTO analysis.</p><div class="w-full max-w-xs"><label for="settings-fto-topic-count">Number of topics to explore for FTO</label><input id="settings-fto-topic-count" name="settings-fto-topic-count" type="range"min="1" max="10" value="4" class="range" step="1" /><!--c moche mais ca marche--><div class="flex justify-between px-2.5 mt-2 text-xs"><span>|</span><span></span><span>|</span><span></span><span></span><span>|</span></div><div class="flex justify-between px-2.5 mt-2 text-xs"><span>1</span><span></span><span>5</span><span></span><span></span><span>10</span></div></div></div><p class="py-4">⚠ 'Save configuration' to keep the current configuration across sessions.</p>
1085 unmodified lines10861087108810891090109110921085 unmodified linesconst url = document.getElementById('settings-provider-url').value;const token = document.getElementById('settings-provider-token').value;populateLLMModelSelect('settings-provider-model', url, token).catch(e => alert("Error while fetching models: " + e))});// ================== solution drafting events =============1085 unmodified lines108610871088108910901091109210931085 unmodified linesconst url = document.getElementById('settings-provider-url').value;const token = document.getElementById('settings-provider-token').value;populateLLMModelSelect('settings-reasoning-model', url, token).catch(e => alert("Error while fetching models: " + e))populateLLMModelSelect('settings-fast-model', url, token).catch(e => alert("Error while fetching models: " + e))});// ================== solution drafting events =============
200 unmodified lines2012022032042052062073 unmodified lines2112122132142152162173 unmodified lines22122222322422522622730 unmodified lines2582592602612622632643 unmodified lines2682692702712722732741 unmodified line2762772782792802812825 unmodified lines2882892902912922932943 unmodified lines298299300301302303304305306307308309310311312313314315200 unmodified linesinsights: zod.array(zod.string()),});export async function assessSolution(providerUrl, modelName, apiKey, solution, assessment_rules, portfolio_info) {const template = await retrieveTemplate("assess");const assessment_template = formatTemplate(template, {3 unmodified linessolution_description: solution.solution_description,});const assessment_full = await generateCompletion(providerUrl, modelName, apiKey, [{ role: "user", content: assessment_template }]);3 unmodified lines"response_schema": zod.toJSONSchema(StructuredAssessmentOutput)})const extracted_info = await generateStructuredCompletion(providerUrl, modelName, apiKey, [{ role: "user", content: structured_filled_template }], StructuredAssessmentOutput);return { assessment_full, extracted_info };}30 unmodified lines/*** Extract the topics to search for FTO*/async function getFtoAnalysisTopics(providerUrl, modelName, apiKey, idea, count) {const template = await retrieveTemplate("fto_topics");const structured_template = formatTemplate(template, {3 unmodified lines"max_topic_count": count});const topics = await generateStructuredCompletion(providerUrl, modelName, apiKey, [{ role: "user", content: structured_template }], FTOAnalysisTopicsSchema);return topics;}1 unmodified line/** Assess the infringement of the idea wrt*/async function assessFTOReport(providerUrl, modelName, apiKey, solution, fto_report, portfolio_info) {const template = await retrieveTemplate("fto_assess");const assessment_template = formatTemplate(template, {5 unmodified linesconsole.log("FTO Length: " + assessment_template.length);const assessment_full = await generateCompletion(providerUrl, modelName, apiKey, [{ role: "user", content: assessment_template }]);3 unmodified lines"response_schema": zod.toJSONSchema(StructuredAssessmentOutput)})const extracted_info = await generateStructuredCompletion(providerUrl, modelName, apiKey, [{ role: "user", content: structured_filled_template }], StructuredAssessmentOutput);return { assessment_full, extracted_info };}export async function runFTOAnalysis(providerUrl, providerModel, apiKey, solution, portfolio_info, ftoTopicCount) {const fto_topics = await getFtoAnalysisTopics(providerUrl, providerModel, apiKey, solution, ftoTopicCount);console.log(fto_topics);const fto_report = await performDeepSearch(fto_topics.topics);const assess_results = await assessFTOReport(providerUrl, providerModel, apiKey, solution, fto_report, portfolio_info);console.log(assess_results.extracted_info);return {200 unmodified lines2012022032042052062073 unmodified lines2112122132142152162173 unmodified lines22122222322422522622730 unmodified lines2582592602612622632643 unmodified lines2682692702712722732741 unmodified line2762772782792802812825 unmodified lines2882892902912922932943 unmodified lines298299300301302303304305306307308309310311312313314315200 unmodified linesinsights: zod.array(zod.string()),});export async function assessSolution(providerUrl, reasoningModel, fastModel, apiKey, solution, assessment_rules, portfolio_info) {const template = await retrieveTemplate("assess");const assessment_template = formatTemplate(template, {3 unmodified linessolution_description: solution.solution_description,});const assessment_full = await generateCompletion(providerUrl, reasoningModel, apiKey, [{ role: "user", content: assessment_template }]);3 unmodified lines"response_schema": zod.toJSONSchema(StructuredAssessmentOutput)})const extracted_info = await generateStructuredCompletion(providerUrl, fastModel, apiKey, [{ role: "user", content: structured_filled_template }], StructuredAssessmentOutput);return { assessment_full, extracted_info };}30 unmodified lines/*** Extract the topics to search for FTO*/async function getFtoAnalysisTopics(providerUrl, reasoningModel, apiKey, idea, count) {const template = await retrieveTemplate("fto_topics");const structured_template = formatTemplate(template, {3 unmodified lines"max_topic_count": count});const topics = await generateStructuredCompletion(providerUrl, reasoningModel, apiKey, [{ role: "user", content: structured_template }], FTOAnalysisTopicsSchema);return topics;}1 unmodified line/** Assess the infringement of the idea wrt*/async function assessFTOReport(providerUrl, reasoningModel, fastModel, apiKey, solution, fto_report, portfolio_info) {const template = await retrieveTemplate("fto_assess");const assessment_template = formatTemplate(template, {5 unmodified linesconsole.log("FTO Length: " + assessment_template.length);const assessment_full = await generateCompletion(providerUrl, reasoningModel, apiKey, [{ role: "user", content: assessment_template }]);3 unmodified lines"response_schema": zod.toJSONSchema(StructuredAssessmentOutput)})const extracted_info = await generateStructuredCompletion(providerUrl, fastModel, apiKey, [{ role: "user", content: structured_filled_template }], StructuredAssessmentOutput);return { assessment_full, extracted_info };}export async function runFTOAnalysis(providerUrl, reasoningModel, fastModel, apiKey, solution, portfolio_info, ftoTopicCount) {const fto_topics = await getFtoAnalysisTopics(providerUrl, reasoningModel, apiKey, solution, ftoTopicCount);console.log(fto_topics);const fto_report = await performDeepSearch(fto_topics.topics);const assess_results = await assessFTOReport(providerUrl, reasoningModel, fastModel, apiKey, solution, fto_report, portfolio_info);console.log(assess_results.extracted_info);return {
12345// clées utilisées pour la generation avec private computeconst CONFIG_KEYS = ["providerUrl", "providerToken", "providerModel", "assessmentRules", "businessPortfolio", "ftoTopicCount"];// clée pour marquer si la config est remplie.const POPULATED_CONFIG_KEY = "_config_populated";12345// clées utilisées pour la generation avec private computeconst CONFIG_KEYS = ["providerUrl", "providerToken", "reasoningModel", "fastModel", "assessmentRules", "businessPortfolio", "ftoTopicCount"];// clée pour marquer si la config est remplie.const POPULATED_CONFIG_KEY = "_config_populated";
355 unmodified lines35635735835936036136236336436536636736836937037137237337437537656 unmodified lines4334344354364374384393 unmodified lines44344444544644744844945045145245345444 unmodified lines499500501502503504505506507508136 unmodified lines64564664764864965065165265365465565665765833 unmodified lines692693694695696697698699700701702703704705355 unmodified linesexport function getConfigFields() {const providerUrl = document.getElementById('settings-provider-url').value;const providerToken = document.getElementById('settings-provider-token').value;const providerModel = document.getElementById('settings-provider-model').value;const assessmentRules = document.getElementById('settings-assessment-rules').value;const businessPortfolio = document.getElementById('settings-portfolio').value;const ftoTopicCount = document.getElementById('settings-fto-topic-count').value;return { providerUrl, providerToken, providerModel, assessmentRules, businessPortfolio, ftoTopicCount };}/*** Vérifie si les paramètres sont bien renseignés pour utiliser la génération privée.*/export function checkPrivateLLMInfoAvailable() {const { providerUrl, providerToken, providerModel, assessmentRules, businessPortfolio } = getConfigFields();const isEmpty = (str) => (!str?.length);return !isEmpty(providerUrl) && !isEmpty(providerToken) && !isEmpty(assessmentRules) && !isEmpty(businessPortfolio) && !isEmpty(providerModel);// return true;}56 unmodified linesconst providerUrl = document.getElementById('settings-provider-url');const providerToken = document.getElementById('settings-provider-token');const providerModel = document.getElementById('settings-provider-model');const assessmentRules = document.getElementById('settings-assessment-rules');const businessPortfolio = document.getElementById('settings-portfolio');const ftoTopicCount = document.getElementById('settings-fto-topic-count');3 unmodified linesassessmentRules.value = configuration.assessmentRules;businessPortfolio.value = configuration.businessPortfolio;ftoTopicCount.value = configuration.ftoTopicCount;// on doit d'abord recup les modeles avant de set la valeurpopulateLLMModelSelect('settings-provider-model', configuration.providerUrl, configuration.providerToken).then(() => {providerModel.value = configuration.providerModel;}).catch(e => {alert("Failed to set LLM model in model selector. Model may not be available anymore, check model in LLM settings.");})}44 unmodified linesswitchTab('draft-tab');const { providerUrl, providerToken, providerModel, assessmentRules, businessPortfolio } = getConfigFields();showLoadingOverlay("Assessing solution ....");assessSolution(providerUrl, providerModel, providerToken, solution, assessmentRules, businessPortfolio).then(response => {// reset the state of the draft historydraftHistory = [];draftCurrentIndex = -1;136 unmodified lines}// ---const { providerUrl, providerToken, providerModel, assessmentRules, businessPortfolio } = getConfigFields();showLoadingOverlay('Refining and assessing ....')refineSolution(providerUrl, providerModel, providerToken, currentState.solution, selectedInsights, userInsightsText, assessmentRules, businessPortfolio).then(newSolution => {const refinedSolution = newSolution;return assessSolution(providerUrl, providerModel, providerToken, newSolution, assessmentRules, businessPortfolio).then(assessedResult => {return { refinedSolution, assessedResult };});33 unmodified lines}export function handleFTOAnalysis() {const { providerUrl, providerToken, providerModel, businessPortfolio, ftoTopicCount } = getConfigFields();const currentState = draftHistory[draftCurrentIndex];console.log("Launching FTO analysis");showLoadingOverlay("Running FTO analysis... This may take a while");runFTOAnalysis(providerUrl, providerModel, providerToken, currentState.solution, businessPortfolio, ftoTopicCount).then(result => {// map from a list of insights to a selectable list of insightsconst newInsights = result.extracted_info.insights.map((e, idx, __) => ({ id: idx, text: e, checked: false }));355 unmodified lines35635735835936036136236336436536636736836937037137237337437537637756 unmodified lines4344354364374384394404413 unmodified lines44544644744844945045145245345445545645745845946046146246344 unmodified lines508509510511512513514515516517136 unmodified lines65465565665765865966066166266366466566666733 unmodified lines701702703704705706707708709710711712713714355 unmodified linesexport function getConfigFields() {const providerUrl = document.getElementById('settings-provider-url').value;const providerToken = document.getElementById('settings-provider-token').value;const reasoningModel = document.getElementById('settings-reasoning-model').value;const fastModel = document.getElementById('settings-fast-model').value;const assessmentRules = document.getElementById('settings-assessment-rules').value;const businessPortfolio = document.getElementById('settings-portfolio').value;const ftoTopicCount = document.getElementById('settings-fto-topic-count').value;return { providerUrl, providerToken, reasoningModel, fastModel, assessmentRules, businessPortfolio, ftoTopicCount };}/*** Vérifie si les paramètres sont bien renseignés pour utiliser la génération privée.*/export function checkPrivateLLMInfoAvailable() {const { providerUrl, providerToken, reasoningModel, fastModel, assessmentRules, businessPortfolio } = getConfigFields();const isEmpty = (str) => (!str?.length);return !isEmpty(providerUrl) && !isEmpty(providerToken) && !isEmpty(assessmentRules) && !isEmpty(businessPortfolio) && !isEmpty(reasoningModel) && !isEmpty(fastModel);// return true;}56 unmodified linesconst providerUrl = document.getElementById('settings-provider-url');const providerToken = document.getElementById('settings-provider-token');const reasoningModel = document.getElementById('settings-reasoning-model');const fastModel = document.getElementById('settings-fast-model');const assessmentRules = document.getElementById('settings-assessment-rules');const businessPortfolio = document.getElementById('settings-portfolio');const ftoTopicCount = document.getElementById('settings-fto-topic-count');3 unmodified linesassessmentRules.value = configuration.assessmentRules;businessPortfolio.value = configuration.businessPortfolio;ftoTopicCount.value = configuration.ftoTopicCount;fastModel.value = configuration.fastModel;// on doit d'abord recup les modeles avant de set la valeurpopulateLLMModelSelect('settings-reasoning-model', configuration.providerUrl, configuration.providerToken).then(() => {reasoningModel.value = configuration.reasoningModel;}).catch(e => {alert("Failed to set LLM model for reasoning in the model selector. Model may not be available anymore, check LLM settings.");})populateLLMModelSelect('settings-fast-model', configuration.providerUrl, configuration.providerToken).then(() => {fastModel.value = configuration.fastModel;}).catch(e => {alert("Failed to set fast LLM model in the model selector. Model may not be available anymore, check LLM settings.");})}44 unmodified linesswitchTab('draft-tab');const { providerUrl, providerToken, reasoningModel, fastModel, assessmentRules, businessPortfolio } = getConfigFields();showLoadingOverlay("Assessing solution ....");assessSolution(providerUrl, reasoningModel, fastModel, providerToken, solution, assessmentRules, businessPortfolio).then(response => {// reset the state of the draft historydraftHistory = [];draftCurrentIndex = -1;136 unmodified lines}// ---const { providerUrl, providerToken, reasoningModel, fastModel, assessmentRules, businessPortfolio } = getConfigFields();showLoadingOverlay('Refining and assessing ....')refineSolution(providerUrl, reasoningModel, providerToken, currentState.solution, selectedInsights, userInsightsText, assessmentRules, businessPortfolio).then(newSolution => {const refinedSolution = newSolution;return assessSolution(providerUrl, reasoningModel, fastModel, providerToken, newSolution, assessmentRules, businessPortfolio).then(assessedResult => {return { refinedSolution, assessedResult };});33 unmodified lines}export function handleFTOAnalysis() {const { providerUrl, providerToken, reasoningModel, fastModel, businessPortfolio, ftoTopicCount } = getConfigFields();const currentState = draftHistory[draftCurrentIndex];console.log("Launching FTO analysis");showLoadingOverlay("Running FTO analysis... This may take a while");runFTOAnalysis(providerUrl, reasoningModel, fastModel, providerToken, currentState.solution, businessPortfolio, ftoTopicCount).then(result => {// map from a list of insights to a selectable list of insightsconst newInsights = result.extracted_info.insights.map((e, idx, __) => ({ id: idx, text: e, checked: false }));
static/index.html+79-53
static/js/app.js+2-1
static/js/gen.js+11-11
static/js/persistence.js+1-1
static/js/ui.js+24-15