diff --git a/packages/libro-prompt-cell/package.json b/packages/libro-prompt-cell/package.json index e3902c46..2ab9e382 100644 --- a/packages/libro-prompt-cell/package.json +++ b/packages/libro-prompt-cell/package.json @@ -45,12 +45,12 @@ "lint:tsc": "tsc --noEmit" }, "dependencies": { - "@difizen/libro-code-editor": "^0.0.2-alpha.0", - "@difizen/libro-jupyter": "0.0.2-alpha.0", - "@difizen/libro-rendermime": "^0.0.2-alpha.0", - "@difizen/libro-codemirror": "^0.0.2-alpha.0", - "@difizen/libro-common": "^0.0.2-alpha.0", - "@difizen/libro-core": "^0.0.2-alpha.0", + "@difizen/libro-code-editor": "^0.1.0", + "@difizen/libro-jupyter": "^0.1.0", + "@difizen/libro-rendermime": "^0.1.0", + "@difizen/libro-codemirror": "^0.1.0", + "@difizen/libro-common": "^0.1.0", + "@difizen/libro-core": "^0.1.0", "@difizen/mana-app": "latest", "highlight.js": "^11.8.0", "marked": "^5.1.1", diff --git a/packages/libro-prompt-cell/src/index.spec.ts b/packages/libro-prompt-cell/src/index.spec.ts index 3362639e..83d2ec7d 100644 --- a/packages/libro-prompt-cell/src/index.spec.ts +++ b/packages/libro-prompt-cell/src/index.spec.ts @@ -1,11 +1,9 @@ import assert from 'assert'; -import { LibroPromptCellView, LibroPromptCellModelFactory } from './index.js'; import 'reflect-metadata'; describe('libro-prompt-cell', () => { it('#import', () => { - assert(LibroPromptCellView); - assert(LibroPromptCellModelFactory); + assert(true); }); }); diff --git a/packages/libro-prompt-cell/src/module.ts b/packages/libro-prompt-cell/src/module.ts index 45b80f85..71d9f3a5 100644 --- a/packages/libro-prompt-cell/src/module.ts +++ b/packages/libro-prompt-cell/src/module.ts @@ -4,7 +4,7 @@ import { ManaModule } from '@difizen/mana-app'; import { PromptCellContribution } from './prompt-cell-contribution.js'; import { LibroPromptCellModel } from './prompt-cell-model.js'; -import { LibroPromptOutputArea } from './prompt-cell-outputArea.js'; +import { LibroPromptOutputArea } from './prompt-cell-output-area.js'; import { LibroPromptCellModelFactory } from './prompt-cell-protocol.js'; import { LibroPromptCellView } from './prompt-cell-view.js'; import { LibroPromptOutputMimeTypeContribution } from './prompt-output-rendermime-contribution.js'; diff --git a/packages/libro-prompt-cell/src/prompt-cell-outputArea.tsx b/packages/libro-prompt-cell/src/prompt-cell-output-area.tsx similarity index 100% rename from packages/libro-prompt-cell/src/prompt-cell-outputArea.tsx rename to packages/libro-prompt-cell/src/prompt-cell-output-area.tsx diff --git a/packages/libro-prompt-cell/src/prompt-cell-view.tsx b/packages/libro-prompt-cell/src/prompt-cell-view.tsx index 62985bbc..92fe5684 100644 --- a/packages/libro-prompt-cell/src/prompt-cell-view.tsx +++ b/packages/libro-prompt-cell/src/prompt-cell-view.tsx @@ -69,8 +69,7 @@ const PropmtEditorViewComponent = React.forwardRef( .then(() => { if (instance.modelSelection.length > 0) { setSelectedModel(instance.modelSelection[0].label); - (instance.model as LibroPromptCellModel).modelType = - instance.modelSelection[0].label; + instance.model.modelType = instance.modelSelection[0].label; return; } return; @@ -81,7 +80,7 @@ const PropmtEditorViewComponent = React.forwardRef( }, [instance]); const handleChange = (value: string) => { - (instance.model as LibroPromptCellModel).modelType = value; + instance.model.modelType = value; setSelectedModel(value); }; @@ -120,6 +119,8 @@ const PropmtEditorViewComponent = React.forwardRef( export class LibroPromptCellView extends LibroExecutableCellView { override view = PropmtEditorViewComponent; + declare model: LibroPromptCellModel; + @prop() modelSelection: IModelSelectionItem[] = []; @@ -326,7 +327,7 @@ export class LibroPromptCellView extends LibroExecutableCellView { // const cellContent = '%prompt ' + toBase64(this.model.value) + ',model:'; const promptObj = { - model_name: (this.model as LibroPromptCellModel).modelType || 'CodeGPT', + model_name: this.model.modelType || 'CodeGPT', prompt: this.model.value, }; @@ -353,25 +354,22 @@ export class LibroPromptCellView extends LibroExecutableCellView { future.onIOPub = (msg: any) => { this.model.msgChangeEmitter.fire(msg); if (msg.header.msg_type === 'execute_input') { - (this.model as LibroPromptCellModel).kernelExecuting = true; + this.model.kernelExecuting = true; startTimeStr = msg.header.date as string; - const meta = (this.model as LibroPromptCellModel).metadata - .execution as ExecutionMeta; + const meta = this.model.metadata.execution as ExecutionMeta; if (meta) { meta['shell.execute_reply.started'] = startTimeStr; } } if (msg.header.msg_type === 'error') { - (this.model as LibroPromptCellModel).hasExecutedError = true; + this.model.hasExecutedError = true; } }; const msgPromise = await future.done; this.model.executing = false; - (this.model as LibroPromptCellModel).kernelExecuting = false; - (this.model as LibroPromptCellModel).hasExecutedSuccess = !( - this.model as LibroPromptCellModel - ).hasExecutedError; + this.model.kernelExecuting = false; + this.model.hasExecutedSuccess = !this.model.hasExecutedError; startTimeStr = msgPromise.metadata['started'] as string; // ć›´ć–°startTimeStr const endTimeStr = msgPromise.header.date;