Skip to content

Commit

Permalink
Merge pull request #391 from elsoul/cli-ai
Browse files Browse the repository at this point in the history
Update - skeet init/ai/check
  • Loading branch information
POPPIN-FUMI authored Apr 7, 2024
2 parents fac6eb7 + 6b9df03 commit 42c389a
Show file tree
Hide file tree
Showing 26 changed files with 626 additions and 699 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-elephants-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@skeet-framework/cli": patch
---

Update - skeet init/ai/check
13 changes: 4 additions & 9 deletions packages/cli/skeet-cloud.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"nsDomain": "your-nameserver.com",
"lbDomain": "loadbalancer.your-app-url.com",
"hasLoadBalancer": false,
"cloudStatus": "NOT_CREATED"
"cloudStatus": "PROJECT_CREATED"
},
"cloudRun": {
"name": "skeet-nextjs-graphql-graphql",
Expand Down Expand Up @@ -138,19 +138,14 @@
"securityPolicyName": "skeet-sql-armor"
}
],
"secretKey": [
"TEST_KEY"
],
"secretKey": ["TEST_KEY"],
"ai": {
"lang": "en",
"ais": [
{
"name": "Gemini",
"availableModels": [
"gemini-1.0-pro",
"gemini-1.0-pro-vision"
]
"availableModels": ["gemini-1.0-pro", "gemini-1.0-pro-vision"]
}
]
}
}
}
6 changes: 5 additions & 1 deletion packages/cli/src/cli/ai/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { SkeetAIOptions } from '.'
import { AIType, chat } from '@skeet-framework/ai'
import { modeSelect } from './modeSelect'
import { skeetMode } from './mode/skeetMode'
import { readOrCreateConfig } from '@/config/readOrCreateConfig'
import { skeetAiPromptV } from './skeetPromptV'

export async function promptUser(
options: SkeetAIOptions,
Expand All @@ -17,6 +19,7 @@ export async function promptUser(
}

console.log('\n')

const userInput = await inquirer.prompt([
{
type: 'input',
Expand Down Expand Up @@ -52,7 +55,8 @@ export async function promptUser(
return
}

const skeetPrompt = skeetAiPrompt('en')
const config = await readOrCreateConfig()
const skeetPrompt = await skeetAiPromptV(config.lang)
await chat(
skeetPrompt.context,
skeetPrompt.examples,
Expand Down
18 changes: 8 additions & 10 deletions packages/cli/src/cli/ai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { program } from '@/index'
import { promptUser } from './ai'
import chalk from 'chalk'
import { AIType } from '@skeet-framework/ai'
import { importConfig } from '@/lib/files/importConfig'
import { AiLog } from './aiLog'
import { validEnv } from './validEnv'
import { validateAiConfig } from './validateAiConfig'
import { modeSelect } from './modeSelect'
import { readOrCreateConfig } from '@/config/readOrCreateConfig'

export type SkeetAIOptions = {
ai: AIType
Expand All @@ -15,15 +14,14 @@ export type SkeetAIOptions = {
export const aiCommands = () => {
program
.command('ai')
.description('AI Playground')
.option('-g, --gemini', 'Gemini')
.option('-o, --openai', 'OpenAI')
.option('-c, --claude', 'Claude')
.option('--mode', 'Mode')
.description('Call Skeet AI Assistant')
.option('-g, --gemini', 'Use Gemini - default')
.option('-o, --openai', 'Use OpenAI')
.option('-c, --claude', 'Use Claude')
.option('--mode', 'Call Mode Select Prompt')
.action(async (options) => {
await validateAiConfig()
const { ai } = await importConfig()
const lang = ai.lang as 'en' | 'ja'
const config = await readOrCreateConfig()
const lang = config.lang as 'en' | 'ja'
const logger = new AiLog(lang)
let aiType = 'Gemini'
if (options.claude) {
Expand Down
Loading

0 comments on commit 42c389a

Please sign in to comment.