chore: update

This commit is contained in:
DDMeaqua 2024-10-11 19:57:33 +08:00
parent 8ec4df4b25
commit 6e38569d5c
12 changed files with 68 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import {
LLMApi, LLMApi,
LLMModel, LLMModel,
SpeechOptions, SpeechOptions,
TranscriptionOptions,
MultimodalContent, MultimodalContent,
} from "../api"; } from "../api";
import Locale from "../../locales"; import Locale from "../../locales";
@ -89,6 +90,10 @@ export class QwenApi implements LLMApi {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
transcription(options: TranscriptionOptions): Promise<string> {
throw new Error("Method not implemented.");
}
async chat(options: ChatOptions) { async chat(options: ChatOptions) {
const messages = options.messages.map((v) => ({ const messages = options.messages.map((v) => ({
role: v.role, role: v.role,

View File

@ -1,5 +1,11 @@
import { Anthropic, ApiPath } from "@/app/constant"; import { Anthropic, ApiPath } from "@/app/constant";
import { ChatOptions, getHeaders, LLMApi, SpeechOptions } from "../api"; import {
ChatOptions,
getHeaders,
LLMApi,
SpeechOptions,
TranscriptionOptions,
} from "../api";
import { import {
useAccessStore, useAccessStore,
useAppConfig, useAppConfig,
@ -77,6 +83,10 @@ export class ClaudeApi implements LLMApi {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
transcription(options: TranscriptionOptions): Promise<string> {
throw new Error("Method not implemented.");
}
extractMessage(res: any) { extractMessage(res: any) {
console.log("[Response] claude response: ", res); console.log("[Response] claude response: ", res);

View File

@ -15,6 +15,7 @@ import {
LLMModel, LLMModel,
MultimodalContent, MultimodalContent,
SpeechOptions, SpeechOptions,
TranscriptionOptions,
} from "../api"; } from "../api";
import Locale from "../../locales"; import Locale from "../../locales";
import { import {
@ -81,6 +82,10 @@ export class ErnieApi implements LLMApi {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
transcription(options: TranscriptionOptions): Promise<string> {
throw new Error("Method not implemented.");
}
async chat(options: ChatOptions) { async chat(options: ChatOptions) {
const messages = options.messages.map((v) => ({ const messages = options.messages.map((v) => ({
// "error_code": 336006, "error_msg": "the role of message with even index in the messages must be user or function", // "error_code": 336006, "error_msg": "the role of message with even index in the messages must be user or function",

View File

@ -14,6 +14,7 @@ import {
LLMModel, LLMModel,
MultimodalContent, MultimodalContent,
SpeechOptions, SpeechOptions,
TranscriptionOptions,
} from "../api"; } from "../api";
import Locale from "../../locales"; import Locale from "../../locales";
import { import {
@ -83,6 +84,10 @@ export class DoubaoApi implements LLMApi {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
transcription(options: TranscriptionOptions): Promise<string> {
throw new Error("Method not implemented.");
}
async chat(options: ChatOptions) { async chat(options: ChatOptions) {
const messages = options.messages.map((v) => ({ const messages = options.messages.map((v) => ({
role: v.role, role: v.role,

View File

@ -6,6 +6,7 @@ import {
LLMModel, LLMModel,
LLMUsage, LLMUsage,
SpeechOptions, SpeechOptions,
TranscriptionOptions,
} from "../api"; } from "../api";
import { import {
useAccessStore, useAccessStore,
@ -68,6 +69,10 @@ export class GeminiProApi implements LLMApi {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
transcription(options: TranscriptionOptions): Promise<string> {
throw new Error("Method not implemented.");
}
async chat(options: ChatOptions): Promise<void> { async chat(options: ChatOptions): Promise<void> {
const apiClient = this; const apiClient = this;
let multimodal = false; let multimodal = false;

View File

@ -13,6 +13,7 @@ import {
LLMApi, LLMApi,
LLMModel, LLMModel,
SpeechOptions, SpeechOptions,
TranscriptionOptions,
} from "../api"; } from "../api";
import Locale from "../../locales"; import Locale from "../../locales";
import { import {
@ -64,6 +65,10 @@ export class SparkApi implements LLMApi {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
transcription(options: TranscriptionOptions): Promise<string> {
throw new Error("Method not implemented.");
}
async chat(options: ChatOptions) { async chat(options: ChatOptions) {
const messages: ChatOptions["messages"] = []; const messages: ChatOptions["messages"] = [];
for (const v of options.messages) { for (const v of options.messages) {

View File

@ -20,6 +20,7 @@ import {
LLMApi, LLMApi,
LLMModel, LLMModel,
SpeechOptions, SpeechOptions,
TranscriptionOptions,
} from "../api"; } from "../api";
import { getClientConfig } from "@/app/config/client"; import { getClientConfig } from "@/app/config/client";
import { getMessageTextContent } from "@/app/utils"; import { getMessageTextContent } from "@/app/utils";
@ -63,6 +64,10 @@ export class MoonshotApi implements LLMApi {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
transcription(options: TranscriptionOptions): Promise<string> {
throw new Error("Method not implemented.");
}
async chat(options: ChatOptions) { async chat(options: ChatOptions) {
const messages: ChatOptions["messages"] = []; const messages: ChatOptions["messages"] = [];
for (const v of options.messages) { for (const v of options.messages) {

View File

@ -34,6 +34,7 @@ import {
LLMUsage, LLMUsage,
MultimodalContent, MultimodalContent,
SpeechOptions, SpeechOptions,
TranscriptionOptions,
} from "../api"; } from "../api";
import Locale from "../../locales"; import Locale from "../../locales";
import { getClientConfig } from "@/app/config/client"; import { getClientConfig } from "@/app/config/client";

View File

@ -9,6 +9,7 @@ import {
LLMModel, LLMModel,
MultimodalContent, MultimodalContent,
SpeechOptions, SpeechOptions,
TranscriptionOptions,
} from "../api"; } from "../api";
import Locale from "../../locales"; import Locale from "../../locales";
import { import {
@ -93,6 +94,10 @@ export class HunyuanApi implements LLMApi {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
transcription(options: TranscriptionOptions): Promise<string> {
throw new Error("Method not implemented.");
}
async chat(options: ChatOptions) { async chat(options: ChatOptions) {
const visionModel = isVisionModel(options.config.model); const visionModel = isVisionModel(options.config.model);
const messages = options.messages.map((v, index) => ({ const messages = options.messages.map((v, index) => ({

View File

@ -99,6 +99,7 @@ import {
} from "./ui-lib"; } from "./ui-lib";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { import {
CHAT_PAGE_SIZE,
DEFAULT_STT_ENGINE, DEFAULT_STT_ENGINE,
DEFAULT_TTS_ENGINE, DEFAULT_TTS_ENGINE,
FIREFOX_DEFAULT_STT_ENGINE, FIREFOX_DEFAULT_STT_ENGINE,

View File

@ -538,6 +538,16 @@ const cn = {
SubTitle: "生成语音的速度", SubTitle: "生成语音的速度",
}, },
}, },
STT: {
Enable: {
Title: "启用语音转文本",
SubTitle: "启用语音转文本",
},
Engine: {
Title: "转换引擎",
SubTitle: "音频转换引擎",
},
},
}, },
Store: { Store: {
DefaultTopic: "新的聊天", DefaultTopic: "新的聊天",

View File

@ -546,6 +546,16 @@ const en: LocaleType = {
}, },
Engine: "TTS Engine", Engine: "TTS Engine",
}, },
STT: {
Enable: {
Title: "Enable STT",
SubTitle: "Enable Speech-to-Text",
},
Engine: {
Title: "STT Engine",
SubTitle: "Text-to-Speech Engine",
},
},
}, },
Store: { Store: {
DefaultTopic: "New Conversation", DefaultTopic: "New Conversation",