@genui-a3/create 0.1.4 → 0.1.5
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/index.js
CHANGED
|
@@ -25,6 +25,12 @@ var PROVIDER_META = {
|
|
|
25
25
|
importPath: "@genui-a3/providers/bedrock",
|
|
26
26
|
factory: "createBedrockProvider",
|
|
27
27
|
models: ["us.anthropic.claude-sonnet-4-5-20250929-v1:0", "us.anthropic.claude-haiku-4-5-20251001-v1:0"]
|
|
28
|
+
},
|
|
29
|
+
anthropic: {
|
|
30
|
+
label: "Anthropic",
|
|
31
|
+
importPath: "@genui-a3/providers/anthropic",
|
|
32
|
+
factory: "createAnthropicProvider",
|
|
33
|
+
models: ["claude-sonnet-4-5-20250929", "claude-haiku-4-5-20251001"]
|
|
28
34
|
}
|
|
29
35
|
};
|
|
30
36
|
|
|
@@ -53,6 +59,9 @@ function generateEnvFile(targetDir, config) {
|
|
|
53
59
|
if (config.providers.includes("openai")) {
|
|
54
60
|
lines.push("# OpenAI", `OPENAI_API_KEY=${config.openaiApiKey || ""}`, "");
|
|
55
61
|
}
|
|
62
|
+
if (config.providers.includes("anthropic")) {
|
|
63
|
+
lines.push("# Anthropic", `ANTHROPIC_API_KEY=${config.anthropicApiKey || ""}`, "");
|
|
64
|
+
}
|
|
56
65
|
if (config.providers.includes("bedrock")) {
|
|
57
66
|
if (config.bedrockAuthMode === "profile") {
|
|
58
67
|
lines.push("# AWS Bedrock (profile mode)", `AWS_PROFILE=${config.awsProfile || "default"}`);
|
|
@@ -187,6 +196,18 @@ async function promptOpenAIConfig(config) {
|
|
|
187
196
|
handleCancel(openaiApiKey);
|
|
188
197
|
config.openaiApiKey = openaiApiKey;
|
|
189
198
|
}
|
|
199
|
+
async function promptAnthropicConfig(config) {
|
|
200
|
+
p.log.step(PROVIDER_META.anthropic.label);
|
|
201
|
+
const anthropicApiKey = await p.text({
|
|
202
|
+
message: "Anthropic API key:",
|
|
203
|
+
placeholder: "sk-ant-...",
|
|
204
|
+
validate(input) {
|
|
205
|
+
if (!input) return "API key is required. Get one at https://console.anthropic.com/settings/keys";
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
handleCancel(anthropicApiKey);
|
|
209
|
+
config.anthropicApiKey = anthropicApiKey;
|
|
210
|
+
}
|
|
190
211
|
async function promptBedrockConfig(config) {
|
|
191
212
|
p.log.step(PROVIDER_META.bedrock.label);
|
|
192
213
|
const authMode = await p.select({
|
|
@@ -281,7 +302,8 @@ async function promptProviders() {
|
|
|
281
302
|
message: "Which LLM provider(s) do you want to configure?",
|
|
282
303
|
options: [
|
|
283
304
|
{ label: "OpenAI", value: "openai" },
|
|
284
|
-
{ label: "AWS Bedrock", value: "bedrock" }
|
|
305
|
+
{ label: "AWS Bedrock", value: "bedrock" },
|
|
306
|
+
{ label: "Anthropic", value: "anthropic" }
|
|
285
307
|
],
|
|
286
308
|
required: true
|
|
287
309
|
});
|
|
@@ -296,6 +318,9 @@ async function promptProviders() {
|
|
|
296
318
|
if (providers.includes("bedrock")) {
|
|
297
319
|
await promptBedrockConfig(config);
|
|
298
320
|
}
|
|
321
|
+
if (providers.includes("anthropic")) {
|
|
322
|
+
await promptAnthropicConfig(config);
|
|
323
|
+
}
|
|
299
324
|
if (providers.length > 1) {
|
|
300
325
|
await promptPrimaryProvider(providers, config);
|
|
301
326
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import { useState, useCallback } from 'react'
|
|
3
|
+
import { useState, useCallback, useEffect, useRef } from 'react'
|
|
4
4
|
import styled from 'styled-components'
|
|
5
5
|
import { TextField, Button, Box } from '@mui/material'
|
|
6
6
|
import type { Theme } from '@mui/material/styles'
|
|
@@ -26,6 +26,18 @@ const InputForm = styled.form`
|
|
|
26
26
|
|
|
27
27
|
export function ChatInput({ onSubmit, disabled, placeholder = 'Type a message...' }: Props) {
|
|
28
28
|
const [value, setValue] = useState('')
|
|
29
|
+
const inputRef = useRef<HTMLInputElement>(null)
|
|
30
|
+
const prevDisabled = useRef(disabled)
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
// When transitioning from disabled (true) back to enabled (false), restore focus
|
|
34
|
+
if (prevDisabled.current && !disabled) {
|
|
35
|
+
// Small timeout to ensure the clear-disabled DOM update finishes
|
|
36
|
+
const timer = setTimeout(() => inputRef.current?.focus(), 10)
|
|
37
|
+
return () => clearTimeout(timer)
|
|
38
|
+
}
|
|
39
|
+
prevDisabled.current = disabled
|
|
40
|
+
}, [disabled])
|
|
29
41
|
|
|
30
42
|
const handleSubmit = useCallback(
|
|
31
43
|
(e: React.FormEvent) => {
|
|
@@ -42,6 +54,7 @@ export function ChatInput({ onSubmit, disabled, placeholder = 'Type a message...
|
|
|
42
54
|
<InputContainer>
|
|
43
55
|
<InputForm onSubmit={handleSubmit}>
|
|
44
56
|
<TextField
|
|
57
|
+
inputRef={inputRef}
|
|
45
58
|
fullWidth
|
|
46
59
|
value={value}
|
|
47
60
|
onChange={(e) => setValue(e.target.value)}
|
package/template/package.json
CHANGED