Skip to content

Commit 5497396

Browse files
committed
fix invalid metadata passing to llm providers
1 parent 3a0c126 commit 5497396

File tree

2 files changed

+13
-5
lines changed
  • apps/desktop/src/components/editor-area
  • packages/utils/src

2 files changed

+13
-5
lines changed

apps/desktop/src/components/editor-area/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ import Editor, { type TiptapEditor } from "@hypr/tiptap/editor";
1515
import Renderer from "@hypr/tiptap/renderer";
1616
import { extractHashtags } from "@hypr/tiptap/shared";
1717
import { cn } from "@hypr/ui/lib/utils";
18-
import { generateText, markdownTransform, modelProvider, providerName, smoothStream, streamText } from "@hypr/utils/ai";
18+
import {
19+
generateText,
20+
localProviderName,
21+
markdownTransform,
22+
modelProvider,
23+
smoothStream,
24+
streamText,
25+
} from "@hypr/utils/ai";
1926
import { useOngoingSession, useSession } from "@hypr/utils/contexts";
2027
import { enhanceFailedToast } from "../toast/shared";
2128
import { FloatingButton } from "./floating-button";
@@ -253,7 +260,7 @@ export function useEnhanceMutation({
253260
smoothStream({ delayInMs: 80, chunking: "line" }),
254261
],
255262
providerOptions: {
256-
[providerName]: {
263+
[localProviderName]: {
257264
metadata: {
258265
grammar: "enhance",
259266
},
@@ -334,7 +341,7 @@ function useGenerateTitleMutation({ sessionId }: { sessionId: string }) {
334341
{ role: "user", content: userMessage },
335342
],
336343
providerOptions: {
337-
[providerName]: {
344+
[localProviderName]: {
338345
metadata: {
339346
grammar: "title",
340347
},

packages/utils/src/ai.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export const useChat = (options: Parameters<typeof useChat$1>[0]) => {
1515
});
1616
};
1717

18-
export const providerName = "hypr-llm";
18+
export const localProviderName = "hypr-llm-local";
19+
export const remoteProviderName = "hypr-llm-remote";
1920

2021
const reasoningMiddleware = extractReasoningMiddleware({
2122
tagName: "thinking",
@@ -28,7 +29,7 @@ const getModel = async ({ onboarding }: { onboarding: boolean }) => {
2829
const { type, connection: { api_base, api_key } } = await getter();
2930

3031
const openai = createOpenAICompatible({
31-
name: providerName,
32+
name: type === "HyprLocal" ? localProviderName : remoteProviderName,
3233
baseURL: api_base,
3334
apiKey: api_key ?? "SOMETHING_NON_EMPTY",
3435
fetch: customFetch,

0 commit comments

Comments
 (0)