@alwith/module-chat 0.6.12 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/image.d.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { type Session } from "@nyssance/codex-acp-v2/client";
|
|
2
2
|
export declare const IMAGE_TOOL = "generate_image";
|
|
3
3
|
export declare const IMAGE_MODELS: readonly [{
|
|
4
|
+
readonly id: "MiniMax-H3-Image";
|
|
5
|
+
readonly label: "MiniMax H3 Image";
|
|
6
|
+
readonly provider: "minimax";
|
|
7
|
+
readonly sizes: readonly ["1K", "2K", "4K"];
|
|
8
|
+
readonly maxReferences: 16;
|
|
9
|
+
}, {
|
|
10
|
+
readonly id: "MiniMax-H3-Image-Highspeed";
|
|
11
|
+
readonly label: "MiniMax H3 Image Highspeed";
|
|
12
|
+
readonly provider: "minimax";
|
|
13
|
+
readonly sizes: readonly ["1K", "2K", "4K"];
|
|
14
|
+
readonly maxReferences: 16;
|
|
15
|
+
}, {
|
|
4
16
|
readonly id: "wham";
|
|
5
17
|
readonly label: "ChatGPT Images";
|
|
6
18
|
readonly provider: "chatgpt";
|
|
@@ -69,6 +81,18 @@ export declare const imageToolSet: {
|
|
|
69
81
|
};
|
|
70
82
|
export declare function imageArtifacts(session: Pick<Session, "items">): ImageArtifact[];
|
|
71
83
|
export declare function imageModel(selection: ImageSelection): {
|
|
84
|
+
readonly id: "MiniMax-H3-Image";
|
|
85
|
+
readonly label: "MiniMax H3 Image";
|
|
86
|
+
readonly provider: "minimax";
|
|
87
|
+
readonly sizes: readonly ["1K", "2K", "4K"];
|
|
88
|
+
readonly maxReferences: 16;
|
|
89
|
+
} | {
|
|
90
|
+
readonly id: "MiniMax-H3-Image-Highspeed";
|
|
91
|
+
readonly label: "MiniMax H3 Image Highspeed";
|
|
92
|
+
readonly provider: "minimax";
|
|
93
|
+
readonly sizes: readonly ["1K", "2K", "4K"];
|
|
94
|
+
readonly maxReferences: 16;
|
|
95
|
+
} | {
|
|
72
96
|
readonly id: "wham";
|
|
73
97
|
readonly label: "ChatGPT Images";
|
|
74
98
|
readonly provider: "chatgpt";
|
package/dist/image.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pt}from"./chunk-b0bd8abz.js";import{isContentEntry as m,isImage as d,isText as p}from"@nyssance/codex-acp-v2/client";var
|
|
1
|
+
import{pt}from"./chunk-b0bd8abz.js";import{isContentEntry as m,isImage as d,isText as p}from"@nyssance/codex-acp-v2/client";var l="generate_image",c=[{id:"MiniMax-H3-Image",label:"MiniMax H3 Image",provider:"minimax",sizes:["1K","2K","4K"],maxReferences:16},{id:"MiniMax-H3-Image-Highspeed",label:"MiniMax H3 Image Highspeed",provider:"minimax",sizes:["1K","2K","4K"],maxReferences:16},{id:"wham",label:"ChatGPT Images",provider:"chatgpt",sizes:["auto"],maxReferences:16},{id:"doubao-seedream-4-5-251128",label:"Seedream 4.5",provider:"seedream",sizes:["2K","4K"],maxReferences:14},{id:"doubao-seedream-5-0-lite-260128",label:"Seedream 5.0 Lite",provider:"seedream",sizes:["2K","3K","4K"],maxReferences:14},{id:"doubao-seedream-5-0-pro-260628",label:"Seedream 5.0 Pro",provider:"seedream",sizes:["1K","2K"],maxReferences:10}],x={model:"wham",size:"auto"},h={version:1,revision:"images-v1",definitions:[{name:l,description:"Generate or edit images using the user's selected image model. Use this tool for image creation and editing. For edits, supply reference IDs returned by earlier calls or the current image request; do not read credentials or call image services yourself. Return the generated image to the user. The host controls model selection.",inputSchema:{type:"object",properties:{prompt:{type:"string",description:"Complete image generation or editing instructions"},references:{type:"array",items:{type:"string"},description:"Image reference IDs supplied by the host or previous image results"}},required:["prompt"],additionalProperties:!1}}]};function I(o){return o.items.flatMap((t)=>{if(!pt(t))return[];let r=t.rawInput,i={};for(let n of t.content.filter(m)){if(!p(n.content)||!n.content.text.startsWith("{"))continue;try{let e=JSON.parse(n.content.text);if(e&&typeof e==="object"&&"kind"in e&&e.kind==="alwith.image")i={..."model"in e&&typeof e.model==="string"?{model:e.model}:{},..."size"in e&&typeof e.size==="string"?{size:e.size}:{}}}catch(e){if(!(e instanceof SyntaxError))throw e}}return t.content.filter(m).flatMap((n,e)=>{if(!d(n.content))return[];let{mimeType:s,data:a}=n.content;return[{id:`${t.id}:${e}`,toolId:t.id,...i,...typeof r?.arguments?.prompt==="string"?{prompt:r.arguments.prompt}:{},mimeType:s,data:a,src:`data:${s};base64,${a}`}]})})}function g(o){let t=c.find((r)=>r.id===o.model);if(!t||!t.sizes.includes(o.size))throw Error("Invalid image model or size");return t}function y(o,t,r){let i=g(o);if(i.provider!=="seedream")throw Error("Expected a Seedream model");if(r.length>i.maxReferences)throw Error(`This model accepts at most ${i.maxReferences} reference images`);return{model:i.id,prompt:t,size:o.size,response_format:"b64_json",watermark:!1,...r.length?{image:r}:{},...i.id==="doubao-seedream-4-5-251128"?{}:{output_format:"png"}}}export{x as DEFAULT_IMAGE_SELECTION,c as IMAGE_MODELS,l as IMAGE_TOOL,I as imageArtifacts,g as imageModel,h as imageToolSet,y as seedreamRequest};
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwith/module-chat",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
"@dnd-kit/sortable": "^10.0.0",
|
|
407
407
|
"@dnd-kit/utilities": "^3.2.2",
|
|
408
408
|
"@floating-ui/dom": "^1.8.0",
|
|
409
|
-
"@nyssance/codex-acp-v2": "^0.7.
|
|
409
|
+
"@nyssance/codex-acp-v2": "^0.7.65",
|
|
410
410
|
"@nyssance/shadcn": "^4.23.4",
|
|
411
411
|
"@shadcn/react": "^0.3.1",
|
|
412
412
|
"@solar-icons/react": "^2.3.5",
|