mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
fix: create model prompt
This commit is contained in:
Binary file not shown.
@@ -148,6 +148,7 @@ export const modelModule = new Elysia({
|
|||||||
.use(adminMiddleware)
|
.use(adminMiddleware)
|
||||||
// Create new model
|
// Create new model
|
||||||
.post('/', async ({ body }) => {
|
.post('/', async ({ body }) => {
|
||||||
|
console.log('body', body)
|
||||||
try {
|
try {
|
||||||
const newModel = await createModel(body as Model)
|
const newModel = await createModel(body as Model)
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export function modelCommands(program: Command) {
|
|||||||
.option('-t, --type <type>', 'Model type (chat/embedding)', 'chat')
|
.option('-t, --type <type>', 'Model type (chat/embedding)', 'chat')
|
||||||
.option('-d, --dimensions <dimensions>', 'Embedding dimensions (required for embedding type)')
|
.option('-d, --dimensions <dimensions>', 'Embedding dimensions (required for embedding type)')
|
||||||
.action(async (options) => {
|
.action(async (options) => {
|
||||||
const spinner = ora('Creating model configuration...').start()
|
// const spinner = ora('Creating model configuration...').start()
|
||||||
try {
|
try {
|
||||||
let { name, modelId, baseUrl, apiKey, clientType, type, dimensions } = options
|
let { name, modelId, baseUrl, apiKey, clientType, type, dimensions } = options
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ export function modelCommands(program: Command) {
|
|||||||
dimensions = answer.dimensions
|
dimensions = answer.dimensions
|
||||||
}
|
}
|
||||||
|
|
||||||
spinner.text = 'Creating model configuration...'
|
// spinner.text = 'Creating model configuration...'
|
||||||
|
|
||||||
const model = await modelCore.createModel({
|
const model = await modelCore.createModel({
|
||||||
name,
|
name,
|
||||||
@@ -149,7 +149,7 @@ export function modelCommands(program: Command) {
|
|||||||
dimensions: dimensions ? (typeof dimensions === 'number' ? dimensions : parseInt(dimensions)) : undefined,
|
dimensions: dimensions ? (typeof dimensions === 'number' ? dimensions : parseInt(dimensions)) : undefined,
|
||||||
})
|
})
|
||||||
|
|
||||||
spinner.succeed(chalk.green('Model configuration created successfully'))
|
// spinner.succeed(chalk.green('Model configuration created successfully'))
|
||||||
console.log(chalk.blue(`Name: ${model.name}`))
|
console.log(chalk.blue(`Name: ${model.name}`))
|
||||||
console.log(chalk.blue(`Model ID: ${model.modelId}`))
|
console.log(chalk.blue(`Model ID: ${model.modelId}`))
|
||||||
console.log(chalk.blue(`Type: ${model.type || 'chat'}`))
|
console.log(chalk.blue(`Type: ${model.type || 'chat'}`))
|
||||||
@@ -158,7 +158,7 @@ export function modelCommands(program: Command) {
|
|||||||
}
|
}
|
||||||
console.log(chalk.blue(`ID: ${model.id}`))
|
console.log(chalk.blue(`ID: ${model.id}`))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
spinner.fail(chalk.red('Operation failed'))
|
// spinner.fail(chalk.red('Operation failed'))
|
||||||
console.error(chalk.red(formatError(error)))
|
console.error(chalk.red(formatError(error)))
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export async function createModel(params: CreateModelParams): Promise<Model> {
|
|||||||
payload.dimensions = params.dimensions
|
payload.dimensions = params.dimensions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const response = await client.model.post(payload)
|
const response = await client.model.post(payload)
|
||||||
|
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user