Have got text transformations working

This commit is contained in:
Leon Mika 2025-09-06 11:26:54 +10:00
parent 9f2fa96b92
commit 41daf7cfc9
14 changed files with 178 additions and 17 deletions

View file

@ -1,4 +1,5 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import {main} from '../models';
export function Greet(arg1:string):Promise<string>;
export function ProcessText(arg1:main.ProcessTextRequest):Promise<void>;

View file

@ -2,6 +2,6 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function Greet(arg1) {
return window['go']['main']['App']['Greet'](arg1);
export function ProcessText(arg1) {
return window['go']['main']['App']['ProcessText'](arg1);
}

53
frontend/wailsjs/go/models.ts Executable file
View file

@ -0,0 +1,53 @@
export namespace main {
export class TextSpan {
text: string;
pos: number;
len: number;
static createFrom(source: any = {}) {
return new TextSpan(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.text = source["text"];
this.pos = source["pos"];
this.len = source["len"];
}
}
export class ProcessTextRequest {
action: string;
input: TextSpan[];
static createFrom(source: any = {}) {
return new ProcessTextRequest(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.action = source["action"];
this.input = this.convertValues(source["input"], TextSpan);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}