Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor some linter issue #97

Merged
merged 18 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4dcb9ff
feat: adding model downloader to llmserver and load apikey dynamically
NarwhalChen Jan 12, 2025
c217a1a
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 12, 2025
179e8ce
feat: initialize codefox-common package with TypeScript configuration…
Sma1lboy Jan 16, 2025
eb4b7e1
feat: refactor model downloader and update TypeScript configuration f…
Sma1lboy Jan 16, 2025
d1dae8e
feat: integrate codefox-common package and update TypeScript configur…
Sma1lboy Jan 16, 2025
c37bef2
feat: enhance model API integration and update TypeScript configurati…
Sma1lboy Jan 16, 2025
16af2a8
feat: remove outdated test files for remote model instances and provi…
Sma1lboy Jan 16, 2025
cb4bf4f
feat: increase concurrency limit for parallel node execution and refa…
Sma1lboy Jan 16, 2025
b1e9be7
feat: update environment configurations and enhance graceful shutdown…
Sma1lboy Jan 16, 2025
7352ba4
feat: improve model fetching logic and enhance error handling in Open…
Sma1lboy Jan 16, 2025
ad3bfc4
feat: add Home component, update .gitignore, and enhance build script…
Sma1lboy Jan 17, 2025
6282fbc
feat: update .gitignore to exclude database files
Sma1lboy Jan 17, 2025
474f223
Merge branch 'main' into feat-moving-download-to-llmserver
Sma1lboy Jan 17, 2025
beaeabe
feat: implement new caching mechanism for improved performance
Sma1lboy Jan 17, 2025
b1ca02a
feat: update ESLint configuration, add fix script, and remove obsolet…
Sma1lboy Jan 17, 2025
3401c14
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 17, 2025
963c412
feat: implement batchChatSyncWithClock function and update model prov…
Sma1lboy Jan 17, 2025
6a8ac10
Merge branch 'main' into chore-refactor
Sma1lboy Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-undef */
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
Expand Down
12 changes: 10 additions & 2 deletions backend/src/build-system/handlers/ux/sitemap-structure/sms-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { BuilderContext } from 'src/build-system/context';
import { BuildHandler, BuildResult } from 'src/build-system/types';
import { prompts } from './prompt';
import { removeCodeBlockFences } from 'src/build-system/utils/strings';
import { chatSyncWithClocker } from 'src/build-system/utils/handler-helper';
import {
batchChatSyncWithClock,
chatSyncWithClocker,
} from 'src/build-system/utils/handler-helper';
import { MessageInterface } from 'src/common/model-provider/types';
import {
MissingConfigurationError,
Expand Down Expand Up @@ -71,7 +74,12 @@ export class Level2UXSitemapStructureHandler implements BuildHandler<string> {
],
}));

const refinedSections = await modelProvider.batchChatSync(requests);
const refinedSections = await batchChatSyncWithClock(
context,
'generate page-by-page by sections',
this.id,
requests,
);

// TODO: deal with chat clocker
// Combine the refined sections into the final document
Expand Down
4 changes: 2 additions & 2 deletions backend/src/build-system/monitor.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Logger } from '@nestjs/common';
import { BuildNode, BuildStep, BuildSequence } from './types';
import { ProjectEventLogger } from './logger';
import { ModelProvider } from 'src/common/model-provider';
import { MessageInterface } from 'src/common/model-provider/types';
import { OpenAIModelProvider } from 'src/common/model-provider/openai-model-provider';
/**
* Metrics for sequence, step, and node execution
*/
Expand Down Expand Up @@ -89,7 +89,7 @@ export class BuildMonitor {
private sequenceMetrics: Map<string, SequenceMetrics> = new Map();
private static timeRecorders: Map<string, any[]> = new Map();

private static model = ModelProvider.getInstance();
private static model = OpenAIModelProvider.getInstance();

private constructor() {
this.logger = new Logger('BuildMonitor');
Expand Down
24 changes: 24 additions & 0 deletions backend/src/build-system/utils/handler-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,27 @@ export async function chatSyncWithClocker(
BuildMonitor.timeRecorder(duration, id, step, inputContent, modelResponse);
return modelResponse;
}

export async function batchChatSyncWithClock(
context: BuilderContext,
step: string,
id: string,
inputs: ChatInput[],
): Promise<string[]> {
const startTime = new Date();
const modelResponses = await context.model.batchChatSync(inputs);
const endTime = new Date();
const duration = endTime.getTime() - startTime.getTime();

const inputContent = inputs
.map((input) => input.messages.map((m) => m.content).join(''))
.join('');
BuildMonitor.timeRecorder(
duration,
id,
step,
inputContent,
modelResponses.join(''),
);
return modelResponses;
}
1 change: 1 addition & 0 deletions codefox-docs/src/components/HomepageFeatures/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-require-imports */
import clsx from 'clsx';
import Heading from '@theme/Heading';
import styles from './styles.module.css';
Expand Down
Loading
Loading