mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
fix(models): models id change can not be save (#49)
This commit is contained in:
@@ -104,6 +104,7 @@ RETURNING *;
|
||||
-- name: UpdateModelByModelID :one
|
||||
UPDATE models
|
||||
SET
|
||||
model_id = sqlc.arg(new_model_id),
|
||||
name = sqlc.arg(name),
|
||||
llm_provider_id = sqlc.arg(llm_provider_id),
|
||||
dimensions = sqlc.arg(dimensions),
|
||||
|
||||
@@ -673,17 +673,19 @@ func (q *Queries) UpdateModel(ctx context.Context, arg UpdateModelParams) (Model
|
||||
const updateModelByModelID = `-- name: UpdateModelByModelID :one
|
||||
UPDATE models
|
||||
SET
|
||||
name = $1,
|
||||
llm_provider_id = $2,
|
||||
dimensions = $3,
|
||||
is_multimodal = $4,
|
||||
type = $5,
|
||||
model_id = $1,
|
||||
name = $2,
|
||||
llm_provider_id = $3,
|
||||
dimensions = $4,
|
||||
is_multimodal = $5,
|
||||
type = $6,
|
||||
updated_at = now()
|
||||
WHERE model_id = $6
|
||||
WHERE model_id = $7
|
||||
RETURNING id, model_id, name, llm_provider_id, dimensions, is_multimodal, type, created_at, updated_at
|
||||
`
|
||||
|
||||
type UpdateModelByModelIDParams struct {
|
||||
NewModelID string `json:"new_model_id"`
|
||||
Name pgtype.Text `json:"name"`
|
||||
LlmProviderID pgtype.UUID `json:"llm_provider_id"`
|
||||
Dimensions pgtype.Int4 `json:"dimensions"`
|
||||
@@ -694,6 +696,7 @@ type UpdateModelByModelIDParams struct {
|
||||
|
||||
func (q *Queries) UpdateModelByModelID(ctx context.Context, arg UpdateModelByModelIDParams) (Model, error) {
|
||||
row := q.db.QueryRow(ctx, updateModelByModelID,
|
||||
arg.NewModelID,
|
||||
arg.Name,
|
||||
arg.LlmProviderID,
|
||||
arg.Dimensions,
|
||||
|
||||
@@ -235,6 +235,7 @@ func (s *Service) UpdateByModelID(ctx context.Context, modelID string, req Updat
|
||||
|
||||
params := sqlc.UpdateModelByModelIDParams{
|
||||
ModelID: modelID,
|
||||
NewModelID: model.ModelID,
|
||||
IsMultimodal: model.IsMultimodal,
|
||||
Type: string(model.Type),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user