mirror of
https://github.com/sortedcord/omnia.git
synced 2026-07-22 03:52:48 +05:30
chore: fix linting issues
This commit is contained in:
@@ -4,7 +4,6 @@ import {
|
||||
WorldState,
|
||||
naturalizeTime,
|
||||
serializeSubjectiveWorldState,
|
||||
resolveAlias,
|
||||
} from "@omnia/core";
|
||||
import {
|
||||
BufferEntry,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, test, expect } from "vitest";
|
||||
import { WorldState, Entity } from "@omnia/core";
|
||||
import { MockLLMProvider } from "@omnia/llm";
|
||||
import { IntentDecoder, IntentSequence } from "@omnia/intent";
|
||||
import { IntentDecoder } from "@omnia/intent";
|
||||
|
||||
describe("IntentDecoder Unit Tests (Tier 1)", () => {
|
||||
test("decodes prose with a single action intent", async () => {
|
||||
|
||||
@@ -13,7 +13,7 @@ export interface PromptBreakdown {
|
||||
components?: PromptComponent[];
|
||||
}
|
||||
|
||||
export interface IPromptBuilder<TArgs extends any[]> {
|
||||
export interface IPromptBuilder<TArgs extends unknown[]> {
|
||||
build(...args: TArgs): PromptBreakdown;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export interface LLMCallRecord {
|
||||
providerInstanceName?: string;
|
||||
maxContext?: number;
|
||||
};
|
||||
response?: any;
|
||||
response?: unknown;
|
||||
}
|
||||
|
||||
export interface ILLMProvider {
|
||||
|
||||
@@ -30,6 +30,7 @@ export class MockLLMProvider implements ILLMProvider {
|
||||
registerGenerative("mock", () => new MockLLMProvider([]));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
static create(inst: ModelProviderInstance): ILLMProvider {
|
||||
return new MockLLMProvider([]);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ vi.mock("@langchain/openai", () => {
|
||||
constructor(config: unknown) {
|
||||
this.config = config;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
embedQuery = vi.fn().mockImplementation(async (text: string) => {
|
||||
return [0.1, 0.2, 0.3];
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Database from "better-sqlite3";
|
||||
import { Entity, resolveAlias } from "@omnia/core";
|
||||
import { Entity } from "@omnia/core";
|
||||
import { Intent } from "@omnia/intent";
|
||||
import { hydrate } from "@omnia/voice";
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ export interface HandoffRunResult {
|
||||
systemPrompt?: string;
|
||||
userContext?: string;
|
||||
promptComponents?: PromptComponent[];
|
||||
response?: any;
|
||||
response?: unknown;
|
||||
}
|
||||
|
||||
export class HandoffEngine {
|
||||
@@ -267,7 +267,11 @@ export class HandoffEngine {
|
||||
};
|
||||
|
||||
const result = response.data;
|
||||
const db = (this.bufferRepo as any).db;
|
||||
const db = (
|
||||
this.bufferRepo as unknown as {
|
||||
db: { transaction: (fn: () => void) => () => void };
|
||||
}
|
||||
).db;
|
||||
|
||||
const ledgerEntries: LedgerEntry[] = [];
|
||||
for (const chunk of result.chunks) {
|
||||
|
||||
@@ -10,7 +10,6 @@ export function splitQuotes(text: string): Segment[] {
|
||||
const segments: Segment[] = [];
|
||||
let current = "";
|
||||
let inQuote = false;
|
||||
let quoteChar = "";
|
||||
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
const char = text[i];
|
||||
@@ -78,7 +77,10 @@ export function dehydrate(
|
||||
// 2. Replace names and aliases with entity@<id>[name]
|
||||
sortedNames.forEach((name) => {
|
||||
const id = nameToId.get(name)!;
|
||||
const escapedName = name.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
||||
const escapedName = name.replace(
|
||||
new RegExp("[-/\\\\^$*+?.()|[\\]{}]", "g"),
|
||||
"\\$&",
|
||||
);
|
||||
const regex = new RegExp(`\\b${escapedName}\\b`, "gi");
|
||||
|
||||
text = text.replace(regex, (matched) => {
|
||||
|
||||
@@ -48,7 +48,7 @@ export function hydrate(content: string, viewer: Entity): string {
|
||||
return seg.text.replace(regex, (matchStr, id, original, followingWord) => {
|
||||
const isSelf = id === viewer.id;
|
||||
const lowerOriginal = original.toLowerCase();
|
||||
let resolvedSubject = "";
|
||||
let resolvedSubject: string;
|
||||
let isThirdPersonSingular = false;
|
||||
|
||||
if (isSelf) {
|
||||
@@ -129,7 +129,8 @@ export function hydrate(content: string, viewer: Entity): string {
|
||||
|
||||
if (followingWord) {
|
||||
if (isThirdPersonSingular) {
|
||||
const conj = nlp(followingWord).verbs().conjugate()[0] as any;
|
||||
const conj = nlp(followingWord).verbs().conjugate()[0] as
|
||||
{ Infinitive?: string; PresentTense?: string } | undefined;
|
||||
if (conj && conj.Infinitive === followingWord && conj.PresentTense) {
|
||||
return `${resolvedSubject} ${conj.PresentTense}`;
|
||||
}
|
||||
@@ -194,7 +195,7 @@ export function hydrateObjective(
|
||||
const entity = worldState.getEntity(id);
|
||||
const name = entity?.attributes.get("name")?.getValue() || id;
|
||||
const lowerOriginal = original.toLowerCase();
|
||||
let resolvedSubject = "";
|
||||
let resolvedSubject: string;
|
||||
let isThirdPersonSingular = false;
|
||||
|
||||
if (firstPersonSet.has(lowerOriginal)) {
|
||||
@@ -220,7 +221,8 @@ export function hydrateObjective(
|
||||
|
||||
if (followingWord) {
|
||||
if (isThirdPersonSingular) {
|
||||
const conj = nlp(followingWord).verbs().conjugate()[0] as any;
|
||||
const conj = nlp(followingWord).verbs().conjugate()[0] as
|
||||
{ Infinitive?: string; PresentTense?: string } | undefined;
|
||||
if (conj && conj.Infinitive === followingWord && conj.PresentTense) {
|
||||
return `${resolvedSubject} ${conj.PresentTense}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user