Skip to content

Commit

Permalink
feat: allow model option for git commit and start chat
Browse files Browse the repository at this point in the history
This commit introduces an optional `model` parameter to both the `git commit` and `start chat` commands. This allows users to specify which model to use instead of relying on the default.
The default value for `model` has been removed from the schema definitions.
  • Loading branch information
yukimemi committed Dec 30, 2024
1 parent 9a1547d commit 3f92ec5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions denops/futago/dispatcher/git_commit.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// =============================================================================
// File : git_commit.ts
// Author : yukimemi
// Last Change : 2024/11/02 23:41:19.
// Last Change : 2024/12/30 09:50:56.
// =============================================================================

import * as fn from "jsr:@denops/std@7.4.0/function";
import type { Denops } from "jsr:@denops/std@7.4.0";
import { DEFAULT_MODEL, GIT_COMMIT_PROMPT } from "../consts.ts";
import { GIT_COMMIT_PROMPT } from "../consts.ts";
import { Futago } from "../futago.ts";
import { GenerationConfigSchema } from "../schema/generation_config.ts";
import { SafetySettingsSchema } from "../schema/safety_settings.ts";
import { z } from "npm:zod@3.24.1";

export const GitCommitParamsSchema = z.object({
model: z.string().optional(),
db: z.instanceof(Deno.Kv),
model: z.string().default(DEFAULT_MODEL),
prompt: z.string().optional(),
safetySettings: SafetySettingsSchema.optional(),
generationConfig: GenerationConfigSchema.optional(),
Expand Down
7 changes: 4 additions & 3 deletions denops/futago/dispatcher/start_chat.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// =============================================================================
// File : start_chat.ts
// Author : yukimemi
// Last Change : 2024/11/02 19:37:06.
// Last Change : 2024/12/30 09:49:46.
// =============================================================================

import * as batch from "jsr:@denops/std@7.4.0/batch";
import * as buffer from "jsr:@denops/std@7.4.0/buffer";
import * as fn from "jsr:@denops/std@7.4.0/function";
import type { Denops } from "jsr:@denops/std@7.4.0";
import { DEFAULT_AI_PROMPT, DEFAULT_HUMAN_PROMPT, DEFAULT_MODEL, SEPARATOR } from "../consts.ts";
import { DEFAULT_AI_PROMPT, DEFAULT_HUMAN_PROMPT, SEPARATOR } from "../consts.ts";
import { Futago } from "../futago.ts";
import { GenerationConfigSchema } from "../schema/generation_config.ts";
import { HistorySchema } from "../schema/history.ts";
Expand All @@ -18,7 +18,7 @@ import { getNow } from "../util.ts";
import { z } from "npm:zod@3.24.1";

export const StartChatParamsSchema = z.object({
model: z.string().default(DEFAULT_MODEL),
model: z.string().optional(),
db: z.instanceof(Deno.Kv),
chatDir: z.string(),
opener: OpenerSchema,
Expand All @@ -36,6 +36,7 @@ export async function startChat(
denops: Denops,
params: StartChatParams,
): Promise<Futago> {
console.log({ params });
const now = getNow();
const bufname = `futago://chat/${now}`;
const buf = await buffer.open(denops, bufname, { opener: params.opener });
Expand Down
2 changes: 1 addition & 1 deletion denops/futago/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// =============================================================================
// File : main.ts
// Author : yukimemi
// Last Change : 2024/12/30 08:11:28.
// Last Change : 2024/12/30 09:31:25.
// =============================================================================

import * as fn from "jsr:@denops/std@7.4.0/function";
Expand Down

0 comments on commit 3f92ec5

Please sign in to comment.