mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-04-21 21:52:07 +02:00
fixed coder, gemini
This commit is contained in:
parent
666b45a194
commit
ea4922e8f0
2 changed files with 3 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { writeFile, readFile, mkdirSync } from 'fs';
|
import { writeFile, readFile, mkdirSync } from 'fs';
|
||||||
|
import settings from '../../settings.js';
|
||||||
|
|
||||||
export class Coder {
|
export class Coder {
|
||||||
constructor(agent) {
|
constructor(agent) {
|
||||||
|
|
|
@ -25,9 +25,11 @@ export class Gemini {
|
||||||
|
|
||||||
const stop_seq = '***';
|
const stop_seq = '***';
|
||||||
const prompt = toSinglePrompt(turns, systemMessage, stop_seq, 'model');
|
const prompt = toSinglePrompt(turns, systemMessage, stop_seq, 'model');
|
||||||
|
console.log('Awaiting Google API response...');
|
||||||
const result = await model.generateContent(prompt);
|
const result = await model.generateContent(prompt);
|
||||||
const response = await result.response;
|
const response = await result.response;
|
||||||
const text = response.text();
|
const text = response.text();
|
||||||
|
console.log('Received.');
|
||||||
if (!text.includes(stop_seq)) return text;
|
if (!text.includes(stop_seq)) return text;
|
||||||
const idx = text.indexOf(stop_seq);
|
const idx = text.indexOf(stop_seq);
|
||||||
return text.slice(0, idx);
|
return text.slice(0, idx);
|
||||||
|
|
Loading…
Add table
Reference in a new issue