Skip to content

Commit

Permalink
🐛 fix: Fix dependency deprecation warning (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
RealTong authored Mar 22, 2024
1 parent 00d42fb commit c869253
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
2 changes: 2 additions & 0 deletions packages/lobe-commit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
},
"dependencies": {
"@inkjs/ui": "^1",
"@langchain/core": "latest",
"@langchain/openai": "latest",
"@lobehub/cli-ui": "1.10.0",
"chalk": "^5",
"commander": "^11",
Expand Down
4 changes: 2 additions & 2 deletions packages/lobe-commit/src/core/Commits.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ChatPromptTemplate } from '@langchain/core/prompts';
import { ChatOpenAI } from '@langchain/openai';
import { alert } from '@lobehub/cli-ui';
import chalk from 'chalk';
import { loadSummarizationChain } from 'langchain/chains';
import { ChatOpenAI } from 'langchain/chat_models/openai';
import { ChatPromptTemplate } from 'langchain/prompts';
import { RecursiveCharacterTextSplitter } from 'langchain/text_splitter';
import { execSync } from 'node:child_process';

Expand Down
4 changes: 2 additions & 2 deletions packages/lobe-commit/src/prompts/commits.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatPromptTemplate, PromptTemplate } from 'langchain/prompts';
import { ChatPromptTemplate, PromptTemplate } from '@langchain/core/prompts';

import gitmojis from '@/constants/gitmojis';
import { selectors } from '@/store';
Expand All @@ -16,7 +16,7 @@ const LOCALE = selectors.getConfig('locale');
const MAX_LENGTH = selectors.getConfig('maxLength');

export const promptCommits = () => {
return ChatPromptTemplate.fromPromptMessages<{
return ChatPromptTemplate.fromMessages<{
summary: string;
}>([
[
Expand Down
4 changes: 2 additions & 2 deletions packages/lobe-commit/src/store/commitStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { kebabCase } from 'lodash-es';
import { create } from 'zustand';
import { createWithEqualityFn } from 'zustand/traditional';

import { type IssuesType, commitMessageToObj, commotObjToMessage } from '@/utils/genCommitMessage';
import getIssuesList from '@/utils/getIssuesList';
Expand Down Expand Up @@ -31,7 +31,7 @@ export interface CommitStore {
subject: string;
type: string;
}
export const useCommitStore = create<CommitStore>((set, get) => ({
export const useCommitStore = createWithEqualityFn<CommitStore>((set, get) => ({
body: '',
emoji: '',
fetchIssuesList: async () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/lobe-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
},
"dependencies": {
"@inkjs/ui": "^1",
"@langchain/core": "latest",
"@langchain/openai": "latest",
"@lobehub/cli-ui": "1.10.0",
"chalk": "^5",
"commander": "^11",
Expand Down
4 changes: 2 additions & 2 deletions packages/lobe-i18n/src/core/TranslateLocale.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChatPromptTemplate } from '@langchain/core/prompts';
import { ChatOpenAI } from '@langchain/openai';
import { alert } from '@lobehub/cli-ui';
import { ChatOpenAI } from 'langchain/chat_models/openai';
import { ChatPromptTemplate } from 'langchain/prompts';

import { promptJsonTranslate, promptStringTranslate } from '@/prompts/translate';
import { LocaleObj } from '@/types';
Expand Down
6 changes: 3 additions & 3 deletions packages/lobe-i18n/src/prompts/translate.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ChatPromptTemplate } from 'langchain/prompts';
import { ChatPromptTemplate } from '@langchain/core/prompts';

const DEFAULT_REFERENCE =
'You can adjust the tone and style, taking into account the cultural connotations and regional differences of certain words. As a translator, you need to translate the original text into a translation that meets the standards of accuracy and elegance.';
export const promptJsonTranslate = (reference: string = DEFAULT_REFERENCE) => {
return ChatPromptTemplate.fromPromptMessages<{
return ChatPromptTemplate.fromMessages<{
from: string;
json: string;
to: string;
Expand All @@ -23,7 +23,7 @@ export const promptJsonTranslate = (reference: string = DEFAULT_REFERENCE) => {
};

export const promptStringTranslate = (reference: string = DEFAULT_REFERENCE) => {
return ChatPromptTemplate.fromPromptMessages<{
return ChatPromptTemplate.fromMessages<{
from: string;
text: string;
to: string;
Expand Down

0 comments on commit c869253

Please sign in to comment.