첫 번째 기여

DDD
풀어 주다: 2024-09-19 06:20:03
원래의
663명이 탐색했습니다.

기여자가 되세요

저는 최근 프로젝트 소유자인 Majd Al Mounayer와 협력하여 TypeScript를 사용하여 구축한 매우 우수한 채팅 완성 애플리케이션에 처음으로 기여했습니다. Majd는 ESLint부터 CI 작업에 이르기까지 개발에 대해 잘 이해하고 있습니다. 그의 프로젝트를 검토하면서 저는 탄탄한 기본 구조로 인해 애플리케이션이 확장 가능하고 새로운 기여자가 기능을 추가하기가 더 쉬워진다는 사실을 알게 되었습니다.

Issue-12 토큰 사용 특집

First Contribute Groq에서 토큰 정보를 얻으세요. #12

First Contribute
페이딩NA 게시일:

Groq 인스턴스를 기반으로 --token_usage 또는 -t 옵션을 제공하여 최적화 목적으로 얼마나 많은 토큰이 반환되거나 사용되는지 모니터링하는 것이 좋습니다. 일부 코드 블록은 각 모델에 적용되는 토큰 제한을 초과할 수 있으므로 이는 중요합니다.

GitHub에서 보기

여러 의견에 대해 토론하고 이 프로젝트에 이 기능을 추가하려면 어떻게 해야 하는지 이해했습니다.

풀 리퀘스트

First Contribute Issue 12 --token-usage & -tu를 통해 토큰 정보 추가 #13

First Contribute
페이딩NA 게시일:

설명

handleTokenFlag를 추가하여 --token-usage 또는 -tu가 포함된 인수 전달을 확인합니다(예인 경우). 토큰 사용에 대해 표준 오류를 발생시킵니다.

  • 빌드 성공

First Contribute

  • 테스트됨

First Contribute

  • 린팅

First Contribute

체크리스트

  • [x] 빌드가 실패하지 않습니다.

  • [x] 현지에서 테스트되었습니다.

  • [x] Linting 오류가 해결된 경우.

테스트 지침

단계

1.

만들기
  • 새로운 종속성 npm 설치

2.

로 이동
  • Optimizeit CD로 이동 OptimizeIt
  • npm run dev -- ./examples/dynamicMemory.cpp --token-usage
GitHub에서 보기

Mounayer의 첫 번째 댓글

First Contribute Issue 12 --token-usage & -tu를 통해 토큰 정보 추가 #13

First Contribute
페이딩NA 게시일:

설명

Adding handleTokenFlag to check argument passing that have --token-usage or -tu if yes we stderr for the token usage.

  • Build Succeed

First Contribute

  • Tested

First Contribute

  • Lintinting

First Contribute

Checklist

  • [x] Build does not fail.

  • [x] Tested locally.

  • [x] Linting errors if any are resolved.

Testing Instructions

Steps

1. Create a

  • new dependencies npm install

2. Go to

  • go to Optimizeit cd OptimizeIt
  • npm run dev -- ./examples/dynamicMemory.cpp --token-usage
View on GitHub

The suggested from him pointing out that on the argument checking into CLI we don't need to wrapped it with try-catch block so I fixed and make a change.

Second comment from Mounayer

First Contribute Issue 12 adding token information by --token-usage & -tu #13

First Contribute
fadingNA posted on

Description

Adding handleTokenFlag to check argument passing that have --token-usage or -tu if yes we stderr for the token usage.

  • Build Succeed

First Contribute

  • Tested

First Contribute

  • Lintinting

First Contribute

Checklist

  • [x] Build does not fail.

  • [x] Tested locally.

  • [x] Linting errors if any are resolved.

Testing Instructions

Steps

1. Create a

  • new dependencies npm install

2. Go to

  • go to Optimizeit cd OptimizeIt
  • npm run dev -- ./examples/dynamicMemory.cpp --token-usage
View on GitHub

When optimizeit processes several files at once the output can be very big. This would then force the user to scroll all the way up to see the tokens which is not user friendly. I think that the token info needs to be displayed at the bottom most of the program output below all processed file outputs.

From the quote I made a change by calling stderr at the end of application to display the token at the bottom most of the application.

Bug detected from Mounayer

First Contribute Issue 12 adding token information by --token-usage & -tu #13

First Contribute
fadingNA posted on

Description

Adding handleTokenFlag to check argument passing that have --token-usage or -tu if yes we stderr for the token usage.

  • Build Succeed

First Contribute

  • Tested

First Contribute

  • Lintinting

First Contribute

Checklist

  • [x] Build does not fail.

  • [x] Tested locally.

  • [x] Linting errors if any are resolved.

Testing Instructions

Steps

1. Create a

  • new dependencies npm install

2. Go to

  • go to Optimizeit cd OptimizeIt
  • npm run dev -- ./examples/dynamicMemory.cpp --token-usage
View on GitHub

This bug because of wrong if condition inside completion processing the if condition check the flag of --token-usage being pass to the argument or not but then I'm using it with else condition which throw the error if not found response.token so instead of

if (tokenUsageInformation && chatCompletion?.usage) {
this.saveTokenUsageInfo(chatCompletion?.usage);
} else {
throw new Error(`
Token Usage Information is not available for file: ${fileName}
`);

change to

if (tokenUsageInformation) {
if (!chatCompletion.usage) {
throw new Error('Token usage information is not available');
}
this.accumulateToken(chatCompletion?.usage);

This ensures that the token usage is properly handled, and if the information is unavailable, an appropriate error is raised without breaking the application flow.

Overall, contributing to this project allowed me to learn more about different coding styles and adapt to them. Majd’s consistency in using ESLint made the development pattern very clear, helping ensure a smooth contribution process.

위 내용은 첫 번째 기여의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

원천:dev.to
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!