Fix bugs (#232)
* fix default engine settings * fix conversation & cloudflare transcribe * update arm64/darwin whisper * empty notice for conversations * display user rankings * fix enjoy ai * update whisper.cpp for arm64 darwin to v1.5.4 * upgrade yarn to 4.1.0
This commit is contained in:
668
.yarn/releases/yarn-4.0.2.cjs → .yarn/releases/yarn-4.1.0.cjs
vendored
Executable file → Normal file
668
.yarn/releases/yarn-4.0.2.cjs → .yarn/releases/yarn-4.1.0.cjs
vendored
Executable file → Normal file
File diff suppressed because one or more lines are too long
@@ -1,4 +1,5 @@
|
||||
nodeLinker: node-modules
|
||||
nmHoistingLimits: workspaces
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.0.2.cjs
|
||||
nodeLinker: node-modules
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.1.0.cjs
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -340,6 +340,7 @@
|
||||
"editConversation": "Edit conversation",
|
||||
"deleteConversation": "Delete conversation",
|
||||
"deleteConversationConfirmation": "Are you sure to delete this conversation inclcuding all messages?",
|
||||
"noConversationsYet": "No conversations yet",
|
||||
"translation": "Translation",
|
||||
"pressEnterToSend": "Press enter to send",
|
||||
"send": "Send",
|
||||
|
||||
@@ -339,6 +339,7 @@
|
||||
"editConversation": "编辑对话",
|
||||
"deleteConversation": "删除对话",
|
||||
"deleteConversationConfirmation": "您确定要删除此对话,以及对话中的所有消息吗?",
|
||||
"noConversationsYet": "还没有对话",
|
||||
"translation": "翻译",
|
||||
"pressEnterToSend": "按 Enter 发送",
|
||||
"send": "发送",
|
||||
|
||||
@@ -139,12 +139,10 @@ export class Conversation extends Model<Conversation> {
|
||||
llm() {
|
||||
if (this.engine === "enjoyai") {
|
||||
return new ChatOpenAI({
|
||||
openAIApiKey: settings.getSync("user.accessToken") as string,
|
||||
modelName: this.model,
|
||||
configuration: {
|
||||
baseURL: `${process.env.WEB_API_URL || WEB_API_URL}/api/ai`,
|
||||
defaultHeaders: {
|
||||
Authorization: `Bearer ${settings.getSync("user.accessToken")}`,
|
||||
},
|
||||
},
|
||||
temperature: this.configuration.temperature,
|
||||
n: this.configuration.numberOfChoices,
|
||||
|
||||
@@ -174,10 +174,8 @@ export class Speech extends Model<Speech> {
|
||||
let openaiConfig = {};
|
||||
if (engine === "enjoyai") {
|
||||
openaiConfig = {
|
||||
apiKey: settings.getSync("user.accessToken"),
|
||||
baseURL: `${process.env.WEB_API_URL || WEB_API_URL}/api/ai`,
|
||||
defaultHeaders: {
|
||||
Authorization: `Bearer ${settings.getSync("user.accessToken")}`,
|
||||
},
|
||||
};
|
||||
} else if (engine === "openai") {
|
||||
const defaultConfig = settings.getSync("openai") as LlmProviderType;
|
||||
|
||||
@@ -255,7 +255,11 @@ class Whipser {
|
||||
|
||||
const data = fs.readFileSync(file);
|
||||
const res: CfWhipserOutputType = (
|
||||
await axios.postForm(`${AI_WORKER_ENDPOINT}/audio/transcriptions`, data)
|
||||
await axios.postForm(`${AI_WORKER_ENDPOINT}/audio/transcriptions`, data, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${settings.getSync("user.accessToken")}`,
|
||||
},
|
||||
})
|
||||
).data;
|
||||
logger.debug("transcription from Web,", res);
|
||||
|
||||
|
||||
@@ -61,6 +61,13 @@ export const ConversationsList = (props: {
|
||||
|
||||
return (
|
||||
<ScrollArea>
|
||||
{conversations.filter((c) => !excludedIds.includes(c.id)).length ===
|
||||
0 && (
|
||||
<div className="text-center text-sm text-muted-foreground py-4">
|
||||
{t("noConversationsYet")}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{conversations
|
||||
.filter((c) => !excludedIds.includes(c.id))
|
||||
.map((conversation) => {
|
||||
|
||||
@@ -76,6 +76,12 @@ export const ConversationsShortcut = (props: {
|
||||
|
||||
return (
|
||||
<ScrollArea>
|
||||
{conversations.length === 0 && (
|
||||
<div className="text-center text-sm text-muted-foreground py-4">
|
||||
{t("noConversationsYet")}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{conversations.map((conversation) => {
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -31,9 +31,10 @@ export const DefaultEngineSettings = () => {
|
||||
<Select
|
||||
value={defaultEngine}
|
||||
onValueChange={(value) => {
|
||||
setDefaultEngine(value);
|
||||
if (value === "openai" && !openai.key) {
|
||||
if (value === "openai" && !openai?.key) {
|
||||
toast.warning(t("openaiKeyRequired"));
|
||||
} else {
|
||||
setDefaultEngine(value);
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from "@renderer/components/ui";
|
||||
import { AppSettingsProviderContext } from "@renderer/context";
|
||||
import { t } from "i18next";
|
||||
import { formatDuration } from "@renderer/lib/utils";
|
||||
import { secondsToTimestamp } from "@renderer/lib/utils";
|
||||
|
||||
export const UsersRankings = () => {
|
||||
return (
|
||||
@@ -59,7 +59,7 @@ const RankingsCard = (props: {
|
||||
|
||||
{rankings.map((user, index) => (
|
||||
<div key={user.id} className="flex items-center space-x-4 p-2">
|
||||
<div className="font-mono text-sm">#{index + 1}</div>
|
||||
<div className="font-mono text-sm w-5">#{index + 1}</div>
|
||||
|
||||
<div className="flex items-center space-x-2">
|
||||
<Avatar className="w-8 h-8">
|
||||
@@ -73,7 +73,7 @@ const RankingsCard = (props: {
|
||||
</div>
|
||||
|
||||
<div className="flex-1 font-serif text-right">
|
||||
{formatDuration(user.recordingsDuration, "millisecond")}
|
||||
{secondsToTimestamp(user.recordingsDuration / 1000.0)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -151,9 +151,8 @@ export const WhisperModelOptions = () => {
|
||||
<ScrollArea className="max-h-96">
|
||||
{availableModels.map((option) => {
|
||||
return (
|
||||
<>
|
||||
<div key={option.name}>
|
||||
<div
|
||||
key={option.name}
|
||||
className={`cursor-pointer hover:bg-secondary px-4 py-2 rounded ${
|
||||
whisperConfig.model === option.name ? "bg-secondary" : ""
|
||||
}`}
|
||||
@@ -188,6 +187,7 @@ export const WhisperModelOptions = () => {
|
||||
<span>~{option.size}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!option.downloaded && option.downloadState && (
|
||||
<div className="flex items-center space-x-2 py-2 px-4">
|
||||
<Progress
|
||||
@@ -216,7 +216,7 @@ export const WhisperModelOptions = () => {
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</ScrollArea>
|
||||
|
||||
@@ -80,7 +80,7 @@ export const AISettingsProvider = ({
|
||||
const _defaultEngine = await EnjoyApp.settings.getDefaultEngine();
|
||||
if (_defaultEngine) {
|
||||
setDefaultEngine(_defaultEngine);
|
||||
} else if (_openai.key) {
|
||||
} else if (_openai?.key) {
|
||||
EnjoyApp.settings.setDefaultEngine("openai").then(() => {
|
||||
setDefaultEngine("openai");
|
||||
});
|
||||
|
||||
@@ -26,22 +26,16 @@ export default () => {
|
||||
<Tabs defaultValue="square">
|
||||
<TabsList className="mb-4">
|
||||
<TabsTrigger value="square">{t("square")}</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="rankings"
|
||||
disabled
|
||||
className="cursor-not-allowed"
|
||||
data-tooltip-id="global-tooltip"
|
||||
data-tooltip-content={t("comingSoon")}
|
||||
>
|
||||
{t("rankings")}
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="rankings">{t("rankings")}</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
<TabsContent value="square">
|
||||
<Posts />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="rankings"></TabsContent>
|
||||
<TabsContent value="rankings">
|
||||
<UsersRankings />
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -180,6 +180,8 @@ export default () => {
|
||||
}, [id]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!conversation) return;
|
||||
|
||||
fetchMessages();
|
||||
}, [conversation]);
|
||||
|
||||
@@ -285,7 +287,6 @@ export default () => {
|
||||
<div className="px-4 absolute w-full bottom-0 left-0 h-14 bg-muted z-50">
|
||||
<div className="focus-within:bg-background px-4 py-2 flex items-center space-x-4 rounded-lg border">
|
||||
<Textarea
|
||||
rows={1}
|
||||
ref={inputRef}
|
||||
disabled={submitting}
|
||||
value={content}
|
||||
|
||||
@@ -25,12 +25,5 @@ export default defineConfig({
|
||||
},
|
||||
optimizeDeps: {
|
||||
exclude: ["@ffmpeg/ffmpeg", "@ffmpeg/util"],
|
||||
},
|
||||
server: {
|
||||
headers: {
|
||||
"Cross-Origin-Resource-Policy": "cross-origin",
|
||||
"Cross-Origin-Opener-Policy": "same-origin",
|
||||
"Cross-Origin-Embedder-Policy": "require-corp",
|
||||
},
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"lint:enjoy": "yarn workspace enjoy eslint --ext .ts,.tsx .",
|
||||
"create-migration:enjoy": "yarn workspace enjoy zx ./src/main/db/create-migration.mjs"
|
||||
},
|
||||
"packageManager": "yarn@4.0.2",
|
||||
"packageManager": "yarn@4.1.0",
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user