on-codemerge
Version:
A WYSIWYG editor for on-codemerge is a user-friendly interface that allows users to edit and view their code in real time, exactly as it will appear in the final product
3 lines (2 loc) • 1.89 kB
JavaScript
/*! on-codemerge v1.3.1 @author Pavel Kuzmin @license MIT @homepage https://s00d.github.io/on-codemerge/ @repository git+https://github.com/s00d/on-codemerge.git Copyright (c) 2026 Pavel Kuzmin - Built on 2026-07-02T13:39:17.947Z */
;var g=Object.defineProperty;var b=(a,t,e)=>t in a?g(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var l=(a,t,e)=>b(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class c{constructor(t){l(this,"apiKey");this.apiKey=t}getOptionsDescription(){return{model:{type:"list",label:"Model",options:["gpt2","gpt-neo-125M","gpt-neo-1.3B","gpt-neo-2.7B","gpt-j-6B","EleutherAI/gpt-neox-20b","bigscience/bloom-560m","bigscience/bloom-1b7","bigscience/bloom-3b","bigscience/bloom-7b1","bigscience/bloom","t5-small","t5-base","t5-large","t5-3b","t5-11b","facebook/bart-base","facebook/bart-large","facebook/bart-large-cnn","google/pegasus-xsum","google/pegasus-large"],default:"gpt2"},maxLength:{type:"number",label:"Max Length",default:100},temperature:{type:"number",label:"Temperature",default:.7},topP:{type:"number",label:"Top P",default:1},topK:{type:"number",label:"Top K",default:50},repetitionPenalty:{type:"number",label:"Repetition Penalty",default:1}}}async generateText(t,e){const r=await fetch(`https://api-inference.huggingface.co/models/${(e==null?void 0:e.model)||"gpt2"}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({inputs:t,parameters:{max_length:(e==null?void 0:e.maxLength)||100,temperature:(e==null?void 0:e.temperature)||.7,top_p:(e==null?void 0:e.topP)||1,top_k:(e==null?void 0:e.topK)||50,repetition_penalty:(e==null?void 0:e.repetitionPenalty)||1}})});if(!r.ok)throw new Error("Failed to generate text with Hugging Face");return(await r.json())[0].generated_text}}exports.HuggingFaceDriver=c;