Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore (ai): update ai models to only haiku (#24)

Eric Hayesbd38bc7a9594
diff --git a/js/app/packages/core/component/AI/component/debug/Attachment.tsx b/js/app/packages/core/component/AI/component/debug/Attachment.tsx
index 8d3d78a67c..8042c5996d 100644
--- a/js/app/packages/core/component/AI/component/debug/Attachment.tsx
+++ b/js/app/packages/core/component/AI/component/debug/Attachment.tsx
@@ -15,6 +15,7 @@ import {
import type { Accessor, JSXElement } from 'solid-js';
import { createEffect, createSignal, For, Match, Show, Switch } from 'solid-js';
import { Dynamic } from 'solid-js/web';
+import { DEFAULT_MODEL } from '../../constant';
import { AttachmentList } from '../input/Attachment';
import * as ATTACHMENTS from './attachments';
import { StreamDebugger } from './stream';
@@ -93,7 +94,7 @@ const requests: (model: Model) => AttachmentTest[] = (model) => [
},
];
-const MODEL: Model = 'anthropic/claude-sonnet-4';
+const MODEL: Model = DEFAULT_MODEL;
export default function DebugAttachments() {
const sends: any = [];
diff --git a/js/app/packages/core/component/AI/component/message/AssistantMessage.tsx b/js/app/packages/core/component/AI/component/message/AssistantMessage.tsx
index 9f5fcbdbd9..395e91dfe9 100644
--- a/js/app/packages/core/component/AI/component/message/AssistantMessage.tsx
+++ b/js/app/packages/core/component/AI/component/message/AssistantMessage.tsx
@@ -2,10 +2,6 @@ import { useSplitLayout } from '@app/component/split-layout/layout';
import { structuredOutputCompletion } from '@core/client/structuredOutput';
import { ChatMessageMarkdown } from '@core/component/AI/component/message/ChatMessageMarkdown';
import { RenderTool } from '@core/component/AI/component/tool/handler';
-import {
- DEFAULT_MODEL,
- // MODEL_PROVIDER_ICON,
-} from '@core/component/AI/constant/model';
import { replaceCitations } from '@core/component/LexicalMarkdown/citationsUtils';
import { ENABLE_TTFT } from '@core/constant/featureFlags';
import { createFromMarkdownText } from '@core/util/md';
@@ -16,8 +12,6 @@ import LoadingIcon from '@phosphor-icons/core/bold/spinner-gap-bold.svg?componen
import type { AssistantMessagePart } from '@service-cognition/generated/schemas/assistantMessagePart';
import type { ChatMessageContent } from '@service-cognition/generated/schemas/chatMessageContent';
import type { ChatMessageWithAttachments } from '@service-cognition/generated/schemas/chatMessageWithAttachments';
-import type { Model } from '@service-cognition/generated/schemas/model';
-import { PrettyModelName } from '@service-cognition/generated/schemas/model';
import { createCallback } from '@solid-primitives/rootless';
import {
createMemo,
@@ -216,13 +210,6 @@ export function AssistantMessage(props: {
setIsLoading(false);
});
- const _modelName = () => {
- const prettyName: string | undefined =
- PrettyModelName[props.message?.model as Model];
- if (!prettyName) return PrettyModelName[DEFAULT_MODEL];
- return prettyName;
- };
-
// ONLY one model for now so don't show icon
// const modelIcon = () => {
// const icon: Component | undefined =
diff --git a/js/app/packages/core/component/AI/component/message/AssistantMessageActionMenu.tsx b/js/app/packages/core/component/AI/component/message/AssistantMessageActionMenu.tsx
index 870954ee1f..c969eaa860 100644
--- a/js/app/packages/core/component/AI/component/message/AssistantMessageActionMenu.tsx
+++ b/js/app/packages/core/component/AI/component/message/AssistantMessageActionMenu.tsx
@@ -1,6 +1,7 @@
import { structuredOutputCompletion } from '@core/client/structuredOutput';
import {
DEFAULT_MODEL,
+ MODEL_PRETTYNAME,
MODEL_PROVIDER_ICON,
} from '@core/component/AI/constant/model';
import { replaceCitations } from '@core/component/LexicalMarkdown/citationsUtils';
@@ -12,7 +13,6 @@ import LoadingIcon from '@phosphor-icons/core/bold/spinner-gap-bold.svg?componen
import type { ChatMessageContent } from '@service-cognition/generated/schemas/chatMessageContent';
import type { ChatMessageWithAttachments } from '@service-cognition/generated/schemas/chatMessageWithAttachments';
import type { Model } from '@service-cognition/generated/schemas/model';
-import { PrettyModelName } from '@service-cognition/generated/schemas/model';
import { createCallback } from '@solid-primitives/rootless';
import { useSplitLayout } from 'app/component/split-layout/layout';
import type { Component } from 'solid-js';
@@ -26,8 +26,8 @@ type AssistantActionProps = {
export function AssistantMessageActionAndMetadata(props: AssistantActionProps) {
const modelName = () => {
const prettyName: string | undefined =
- PrettyModelName[props.message?.model as Model];
- if (!prettyName) return PrettyModelName[DEFAULT_MODEL];
+ MODEL_PRETTYNAME[props.message?.model as Model];
+ if (!prettyName) return MODEL_PRETTYNAME[DEFAULT_MODEL];
return prettyName;
};
diff --git a/js/app/packages/core/component/AI/constant/model.ts b/js/app/packages/core/component/AI/constant/model.ts
index c06d64a738..7e2cb5d36e 100644
--- a/js/app/packages/core/component/AI/constant/model.ts
+++ b/js/app/packages/core/component/AI/constant/model.ts
@@ -4,23 +4,25 @@ import type { Model } from '@core/component/AI/types';
// import GoogleLogo from '@phosphor-icons/core/bold/google-logo-bold.svg?component-solid';
// import OpenAiLogoIcon from '@phosphor-icons/core/regular/open-ai-logo.svg?component-solid';
-export { Model, ModelEnum } from '@core/component/AI/types';
+export { Model } from '@core/component/AI/types';
export { AllModels } from '@service-cognition/generated/schemas/model';
type ExhaustiveMap = {
[K in Model]: any;
};
-export const MODEL_DESCRIPTION: ExhaustiveMap = {
- 'anthropic/claude-sonnet-4': 'The best general purpose model from Anthropic',
-} as const;
+// export const MODEL_DESCRIPTION: ExhaustiveMap = {
+// 'anthropic/claude-sonnet-4': 'The best general purpose model from Anthropic',
+// } as const;
export const MODEL_PRETTYNAME: ExhaustiveMap = {
- 'anthropic/claude-sonnet-4': 'Claude Sonnet 4',
+ 'claude-sonnet-4-5': 'Claude Sonnet 4.5',
+ 'claude-haiku-4-5': 'Claude Haiku 4.5',
} as const;
export const MODEL_PROVIDER_ICON: ExhaustiveMap = {
- 'anthropic/claude-sonnet-4': AnthropicIcon,
+ 'claude-haiku-4-5': AnthropicIcon,
+ 'claude-sonnet-4-5': AnthropicIcon,
};
-export const DEFAULT_MODEL: Model = 'anthropic/claude-sonnet-4';
+export const DEFAULT_MODEL: Model = 'claude-haiku-4-5';
diff --git a/js/app/packages/core/component/AI/types/index.ts b/js/app/packages/core/component/AI/types/index.ts
index 11ece27024..0bd9c68bc5 100644
--- a/js/app/packages/core/component/AI/types/index.ts
+++ b/js/app/packages/core/component/AI/types/index.ts
@@ -5,7 +5,6 @@ export type {
ToolSet,
} from '@service-cognition/generated/schemas';
export { Model } from '@service-cognition/generated/schemas';
-export { ModelEnum } from '@service-cognition/generated/schemas/model';
export type { MessageStream, StreamItem } from '@service-cognition/websocket';
export * from './attachment';
export * from './service';
diff --git a/js/app/packages/core/component/AI/util/mockMessage.ts b/js/app/packages/core/component/AI/util/mockMessage.ts
index 7b51962b24..7c625a1eaa 100644
--- a/js/app/packages/core/component/AI/util/mockMessage.ts
+++ b/js/app/packages/core/component/AI/util/mockMessage.ts
@@ -1,4 +1,5 @@
import { uuid } from 'short-uuid';
+import { DEFAULT_MODEL } from '../constant';
import { type ChatMessageWithAttachments, Model } from '../types';
// TODO mock attachments
@@ -8,7 +9,7 @@ function user(text: string, _attachments: [] = []): ChatMessageWithAttachments {
content: text,
id: uuid(),
role: 'user',
- model: Model['anthropic/claude-sonnet-4'],
+ model: Model[DEFAULT_MODEL],
};
}
diff --git a/js/app/packages/core/component/AI/util/parse.ts b/js/app/packages/core/component/AI/util/parse.ts
index fe6d3e46be..bbdab234a0 100644
--- a/js/app/packages/core/component/AI/util/parse.ts
+++ b/js/app/packages/core/component/AI/util/parse.ts
@@ -1,4 +1,5 @@
-import { type Model, ModelEnum } from '../types';
+import { ModelEnum } from '@service-cognition/generated/schemas';
+import type { Model } from '../types';
/**
* Parses a Model type from a string.
diff --git a/js/app/packages/core/component/AI/util/stream/mockStream.ts b/js/app/packages/core/component/AI/util/stream/mockStream.ts
index 867cc5892b..f7fbcdda55 100644
--- a/js/app/packages/core/component/AI/util/stream/mockStream.ts
+++ b/js/app/packages/core/component/AI/util/stream/mockStream.ts
@@ -2,6 +2,7 @@ import type { NamedTool } from '@service-cognition/generated/tools/tool';
import type { MessageStream, StreamItem } from '@service-cognition/websocket';
import { uuid } from 'short-uuid';
import { createEffect, createSignal } from 'solid-js';
+import { DEFAULT_MODEL } from '../../constant';
import { characters } from './splitStream';
import type { NetworkDelay, Splitter } from './types';
@@ -17,7 +18,7 @@ const makeFakeRequst = () =>
({
chat_id: MOCK_ID,
content: 'test',
- model: 'anthropic/claude-sonnet-4',
+ model: DEFAULT_MODEL,
type: 'send_chat_message',
token: '??',
stream_id: MOCK_ID,
diff --git a/js/app/packages/service-cognition/generated/schemas/model.ts b/js/app/packages/service-cognition/generated/schemas/model.ts
index 5645c13734..ee95db3ddf 100644
--- a/js/app/packages/service-cognition/generated/schemas/model.ts
+++ b/js/app/packages/service-cognition/generated/schemas/model.ts
@@ -7,23 +7,19 @@ import {z} from 'zod';
export type Model = typeof Model[keyof typeof Model];
export const Model = {
- "anthropic/claude-sonnet-4": "anthropic/claude-sonnet-4",
+ "claude-haiku-4-5": "claude-haiku-4-5",
+ "claude-sonnet-4-5": "claude-sonnet-4-5",
} as const;
- /** @deprecated use constant in @core/component/AI instead */
- const values: [Model, ...Model[]] = [
- Object.values(Model)[0],
- ...Object.values(Model).slice(1),
+export const AllModels: Model[] = [
+ "claude-haiku-4-5",
+ "claude-sonnet-4-5"
+] as const;
+const values: [Model, ...Model[]] = [
+Object.values(Model)[0],
+...Object.values(Model).slice(1),
];
export const ModelEnum = z.enum(values);
-export const PrettyModelName: Record<Model, string> = {
- "anthropic/claude-sonnet-4": "Claude 4.0 Sonnet",
-} as const;
-
-export const AllModels: Model[] = [
- "anthropic/claude-sonnet-4"
-] as const;
-
\ No newline at end of file
diff --git a/js/app/packages/service-cognition/generated/schemas/modelMetadata.ts b/js/app/packages/service-cognition/generated/schemas/modelMetadata.ts
index c2e3437f77..0ac151d9e3 100644
--- a/js/app/packages/service-cognition/generated/schemas/modelMetadata.ts
+++ b/js/app/packages/service-cognition/generated/schemas/modelMetadata.ts
@@ -6,15 +6,5 @@
*/
export interface ModelMetadata {
- /** The token size of the context window */
contextWindow: number;
- /** A description of the model */
- description: string;
- /** The display name of the model */
- displayName: string;
- premium: boolean;
- /** Scale of quality from 0 to 5 */
- quality: number;
- /** Scale of speed from 0 to 5 */
- speed: number;
}
diff --git a/js/app/packages/service-cognition/generated/tools/schemas.ts b/js/app/packages/service-cognition/generated/tools/schemas.ts
index 2f9ce842dc..64d2f3efdb 100644
--- a/js/app/packages/service-cognition/generated/tools/schemas.ts
+++ b/js/app/packages/service-cognition/generated/tools/schemas.ts
@@ -64,11 +64,11 @@ export const ReadOutputSchema = z.object({ "content": z.any().superRefine((x, ct
}) })
-export const UnifiedSearchInputSchema = z.object({ "exhaustiveSearch": z.boolean().default(true), "pageOffset": z.number().int().default(0), "pageSize": z.number().int().default(10), "request": z.object({ "filters": z.union([z.object({ "channel": z.union([z.object({ "channel_ids": z.array(z.string()), "mentions": z.array(z.string()), "org_id": z.union([z.number().int(), z.null()]), "sender_ids": z.array(z.string()), "thread_ids": z.array(z.string()) }).strict(), z.null()]), "chat": z.union([z.object({ "chat_ids": z.array(z.string()), "owners": z.array(z.string()), "project_ids": z.array(z.string()), "role": z.array(z.string()) }).strict(), z.null()]), "document": z.union([z.object({ "document_ids": z.array(z.string()), "file_types": z.array(z.string()), "owners": z.array(z.string()), "project_ids": z.array(z.string()) }).strict(), z.null()]), "email": z.union([z.object({ "bcc": z.array(z.string()), "cc": z.array(z.string()), "recipients": z.array(z.string()), "senders": z.array(z.string()) }).strict(), z.null()]), "project": z.union([z.object({ "owners": z.array(z.string()), "project_ids": z.array(z.string()) }).strict(), z.null()]) }).strict(), z.null()]), "include": z.array(z.enum(["documents","chats","emails","channels","projects"])).default([]), "match_type": z.enum(["exact","partial","regexp"]), "search_on": z.enum(["name","content","name_content"]).default("content"), "terms": z.union([z.array(z.string()), z.null()]) }).strict() }).strict()
+export const UnifiedSearchInputSchema = z.object({ "exhaustiveSearch": z.boolean().default(true), "pageOffset": z.number().int().default(0), "pageSize": z.number().int().default(10), "request": z.object({ "filters": z.union([z.object({ "channel": z.union([z.object({ "channel_ids": z.array(z.string()), "mentions": z.array(z.string()), "org_id": z.union([z.number().int(), z.null()]), "sender_ids": z.array(z.string()), "thread_ids": z.array(z.string()) }).strict(), z.null()]), "chat": z.union([z.object({ "chat_ids": z.array(z.string()), "owners": z.array(z.string()), "project_ids": z.array(z.string()), "role": z.array(z.string()) }).strict(), z.null()]), "document": z.union([z.object({ "document_ids": z.array(z.string()), "file_types": z.array(z.string()), "owners": z.array(z.string()), "project_ids": z.array(z.string()) }).strict(), z.null()]), "email": z.union([z.object({ "bcc": z.array(z.string()), "cc": z.array(z.string()), "recipients": z.array(z.string()), "senders": z.array(z.string()) }).strict(), z.null()]), "project": z.union([z.object({ "owners": z.array(z.string()), "project_ids": z.array(z.string()) }).strict(), z.null()]) }).strict(), z.null()]), "include": z.array(z.enum(["documents","chats","emails","channels","projects"])).default([]), "match_type": z.enum(["exact","partial","regexp"]), "name_only": z.union([z.boolean(), z.null()]), "terms": z.union([z.array(z.string()), z.null()]) }).strict() }).strict()
export const UnifiedSearchOutputSchema = z.object({ "response": z.object({ "results": z.array(z.any().superRefine((x, ctx) => {
- const schemas = [z.object({ "content": z.union([z.array(z.string()), z.null()]).optional(), "document_id": z.string(), "document_name": z.string(), "file_type": z.string(), "node_id": z.string(), "owner_id": z.string(), "raw_content": z.union([z.string(), z.null()]).optional(), "type": z.literal("document"), "updated_at": z.string().datetime({ offset: true }) }), z.object({ "chat_id": z.string(), "chat_message_id": z.string(), "content": z.union([z.array(z.string()), z.null()]).optional(), "role": z.string(), "title": z.string(), "type": z.literal("chat"), "updated_at": z.string().datetime({ offset: true }), "user_id": z.string() }), z.object({ "bcc": z.array(z.string()), "cc": z.array(z.string()), "content": z.union([z.array(z.string()), z.null()]).optional(), "labels": z.array(z.string()), "link_id": z.string(), "message_id": z.string(), "recipients": z.array(z.string()), "sender": z.string(), "sent_at": z.union([z.string().datetime({ offset: true }), z.null()]).optional(), "subject": z.union([z.string(), z.null()]).optional(), "thread_id": z.string(), "type": z.literal("email"), "updated_at": z.string().datetime({ offset: true }), "user_id": z.string() }), z.object({ "channel_id": z.string(), "channel_name": z.union([z.string(), z.null()]).optional(), "channel_type": z.string(), "content": z.union([z.array(z.string()), z.null()]).optional(), "created_at": z.string().datetime({ offset: true }), "mentions": z.array(z.string()), "message_id": z.string(), "org_id": z.union([z.number().int(), z.null()]).optional(), "sender_id": z.string(), "thread_id": z.union([z.string(), z.null()]).optional(), "type": z.literal("channel"), "updated_at": z.string().datetime({ offset: true }) }), z.object({ "content": z.union([z.array(z.string()), z.null()]).optional(), "created_at": z.string().datetime({ offset: true }), "project_id": z.string(), "project_name": z.string(), "type": z.literal("project"), "updated_at": z.string().datetime({ offset: true }), "user_id": z.string() })];
+ const schemas = [z.object({ "content": z.union([z.array(z.string()), z.null()]).optional(), "document_id": z.string(), "document_name": z.string(), "file_type": z.string(), "node_id": z.string(), "owner_id": z.string(), "raw_content": z.union([z.string(), z.null()]).optional(), "type": z.literal("document"), "updated_at": z.string().datetime({ offset: true }) }), z.object({ "chat_id": z.string(), "chat_message_id": z.string(), "content": z.union([z.array(z.string()), z.null()]).optional(), "role": z.string(), "title": z.string(), "type": z.literal("chat"), "updated_at": z.string().datetime({ offset: true }), "user_id": z.string() }), z.object({ "bcc": z.array(z.string()), "cc": z.array(z.string()), "content": z.union([z.array(z.string()), z.null()]).optional(), "labels": z.array(z.string()), "link_id": z.string(), "message_id": z.string(), "recipients": z.array(z.string()), "sender": z.string(), "sent_at": z.union([z.string().datetime({ offset: true }), z.null()]).optional(), "subject": z.union([z.string(), z.null()]).optional(), "thread_id": z.string(), "type": z.literal("email"), "updated_at": z.string().datetime({ offset: true }), "user_id": z.string() }), z.object({ "channel_id": z.string(), "channel_name": z.union([z.string(), z.null()]).optional(), "channel_type": z.string(), "content": z.union([z.array(z.string()), z.null()]).optional(), "created_at": z.string().datetime({ offset: true }), "mentions": z.array(z.string()), "message_id": z.string(), "org_id": z.union([z.number().int(), z.null()]).optional(), "sender_id": z.string(), "thread_id": z.union([z.string(), z.null()]).optional(), "type": z.literal("channel"), "updated_at": z.string().datetime({ offset: true }) }), z.object({ "content": z.union([z.array(z.string()), z.null()]).optional(), "created_at": z.string().datetime({ offset: true }), "parent_project_id": z.union([z.string(), z.null()]).optional(), "project_id": z.string(), "project_name": z.string(), "type": z.literal("project"), "updated_at": z.string().datetime({ offset: true }), "user_id": z.string() })];
const errors = schemas.reduce<z.ZodError[]>(
(errors, schema) =>
((result) =>
diff --git a/js/app/packages/service-cognition/generated/tools/types.ts b/js/app/packages/service-cognition/generated/tools/types.ts
index 5b1cdc04b3..831163aa39 100644
--- a/js/app/packages/service-cognition/generated/tools/types.ts
+++ b/js/app/packages/service-cognition/generated/tools/types.ts
@@ -484,9 +484,9 @@ export interface UnifiedSearchInput {
*/
match_type: 'exact' | 'partial' | 'regexp';
/**
- * Fields to search on (Name, Content, NameContent). Defaults to Content
+ * If true, match the `terms` field on name only. If false, names will not be matched on in the search. False by default.
*/
- search_on: 'name' | 'content' | 'name_content';
+ name_only: boolean | null;
/**
* Multiple distinct search terms as separate strings. Use this for keyword-based searches where you want to find content containing any of these terms. Each term must be at least 3 characters (shorter terms are automatically filtered out). Examples: ['machine', 'learning', 'algorithms'], ['project', 'status', 'update']. `null` this field if searching without text terms to search all. This field matches query string against both name and content.
*/
@@ -688,6 +688,10 @@ export interface UnifiedSearchOutput {
* The time the project was created
*/
created_at: string;
+ /**
+ * The parent project id
+ */
+ parent_project_id?: string | null;
/**
* The project id
*/
diff --git a/js/app/packages/service-cognition/openapi.json b/js/app/packages/service-cognition/openapi.json
index 5d51cdaed5..b156cf27e9 100644
--- a/js/app/packages/service-cognition/openapi.json
+++ b/js/app/packages/service-cognition/openapi.json
@@ -2451,58 +2451,30 @@
"Model": {
"type": "string",
"enum": [
- "google/gemini-2.5-pro",
- "google/gemini-2.0-flash-001",
- "google/gemini-2.0-flash-lite-001",
- "google/gemini-pro-1.5",
- "openai/gpt-5",
- "openai/gpt-4.1",
- "openai/gpt-4o",
- "openai/gpt-4o-mini",
- "openai/o1",
- "openai/gpt-4o-search-preview",
- "openai/gpt-4o-mini-search-preview",
- "openai/o3",
- "anthropic/claude-3.5-sonnet",
- "anthropic/claude-3.7-sonnet",
- "anthropic/claude-sonnet-4"
+ "gemini-2.5-pro",
+ "gemini-2.0-flash-001",
+ "gemini-2.0-flash-lite-001",
+ "gemini-pro-1.5",
+ "gpt-5",
+ "gpt-4.1",
+ "gpt-4o",
+ "gpt-4o-mini",
+ "o1",
+ "gpt-4o-search-preview",
+ "gpt-4o-mini-search-preview",
+ "o3",
+ "claude-3-5-sonnet",
+ "claude-3-7-sonnet",
+ "claude-sonnet-4",
+ "claude-sonnet-4-5",
+ "claude-haiku-4-5"
]
},
"ModelMetadata": {
"type": "object",
- "required": [
- "description",
- "contextWindow",
- "speed",
- "quality",
- "premium",
- "displayName"
- ],
+ "required": ["contextWindow"],
"properties": {
- "contextWindow": {
- "type": "integer",
- "format": "int32",
- "description": "The token size of the context window"
- },
- "description": {
- "type": "string",
- "description": "A description of the model"
- },
- "displayName": {
- "type": "string",
- "description": "The display name of the model"
- },
- "premium": { "type": "boolean" },
- "quality": {
- "type": "integer",
- "format": "int32",
- "description": "Scale of quality from 0 to 5"
- },
- "speed": {
- "type": "integer",
- "format": "int32",
- "description": "Scale of speed from 0 to 5"
- }
+ "contextWindow": { "type": "integer", "format": "int32" }
}
},
"NewAttachment": {
diff --git a/js/app/scripts/generate-dcs-models.ts b/js/app/scripts/generate-dcs-models.ts
index e0500a4144..3c1ce1cb0a 100644
--- a/js/app/scripts/generate-dcs-models.ts
+++ b/js/app/scripts/generate-dcs-models.ts
@@ -11,12 +11,7 @@ const ModelSchema = z.object({
name: z.string(),
provider: z.string(),
metadata: z.object({
- description: z.string(),
contextWindow: z.number(),
- speed: z.number(),
- quality: z.number(),
- premium: z.boolean(),
- displayName: z.string()
})
});
@@ -26,7 +21,6 @@ const ModelResponseSchema = z.object({
type ModelResponse = z.infer<typeof ModelResponseSchema>;
-
async function fetchModels(): Promise<ModelResponse> {
const baseUrl = serviceUrl(documentCognitionBase)
@@ -36,6 +30,7 @@ async function fetchModels(): Promise<ModelResponse> {
throw new Error("bad response from DCS")
}
const models = await response.json();
+
return ModelResponseSchema.parse(models);
}
@@ -52,25 +47,6 @@ ${models.models
} as const;`
}
-function prettyModelName(models: ModelResponse): string {
- return `
- /** @deprecated use constant in @core/component/AI instead */
- const values: [Model, ...Model[]] = [
- Object.values(Model)[0],
- ...Object.values(Model).slice(1),
-];
-
-export const ModelEnum = z.enum(values);
-
-export const PrettyModelName: Record<Model, string> = {
-${models.models.map(model => (
- ` "${model.name}": "${model.metadata.displayName}",`
-))
-.join("\n")
-}
-} as const;
-`
-}
function warning(): string {
return`/* Generated by scripts/generate-models-enum.ts
@@ -85,7 +61,16 @@ function allModels(models: ModelResponse): string {
export const AllModels: Model[] = [
${models.models.map(model => (` "${model.name}"`)).join(',\n')}
] as const;
- `
+const values: [Model, ...Model[]] = [
+Object.values(Model)[0],
+...Object.values(Model).slice(1),
+];
+
+export const ModelEnum = z.enum(values);
+
+
+`
+
}
@@ -94,7 +79,6 @@ const contents = [
warning(),
"import {z} from 'zod';",
modelType(models),
- prettyModelName(models),
allModels(models)
].join("\n");