Skip to content

Commit

Permalink
fix: improve logging format for chat history and update prompt defini…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
yuiseki committed Nov 9, 2024
1 parent 426de6b commit cebadd8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/app/api/ai/inner/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function POST(request: Request) {

console.log("");
console.log("chatHistoryLines:");
console.log(chatHistoryLines);
console.log(chatHistoryLines.join("\n"));

let llm: ChatOpenAI;
let embeddings: OpenAIEmbeddings;
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/ai/surface/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function POST(request: Request) {

console.log("");
console.log("chatHistoryLines:");
console.log(chatHistoryLines);
console.log(chatHistoryLines.join("\n"));

let llm: ChatOpenAI;
let embeddings: OpenAIEmbeddings;
Expand Down
8 changes: 5 additions & 3 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,10 @@ export default function Home() {
}}
/>
)}
{(!responding && !mapping && dialogueList.length > 1) ||
(ability && ["apology", "ask-more"].includes(ability) && (
{!responding &&
!mapping &&
dialogueList.length > 1 &&
!(ability && ["apology", "ask-more"].includes(ability)) && (
<InputPredict
dialogueList={dialogueList}
onUpdateSuggestions={() => {
Expand All @@ -424,7 +426,7 @@ export default function Home() {
onSubmit(value);
}}
/>
))}
)}
</LocationProvider>
<div style={{ height: "1px" }} ref={dialogueEndRef} />
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/utils/langchain/chains/surface/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,15 @@ Reply: 了解しました。OpenStreetMapのデータに基づいて台東区と
},
];

const tridentSurfacePromptPrefix = `Your name is TRIDENT, You are an interactive web maps generating assistant. You interact with the human, asking step-by-step about the areas and concerns of the map they want to create.
const tridentSurfacePromptPrefix = `Your name is TRIDENT, You are an interactive web maps generating assistant.
You interact with the human, asking step-by-step about the areas and concerns of the map they want to create.
### Definition of output format: ###
- Ability: Text that indicates required ability to generate maps.
- Reply: Text that indicates the response to the human.
You will always reply according to the following rules:
- You MUST ALWAYS reply according to the output format.
- You MUST ALWAYS reply IN THE LANGUAGE WHICH HUMAN IS WRITING.
- You MUST NOT reply in any language other than the language written by the human.
- You reply with the most accurate grammar possible.
Expand Down

0 comments on commit cebadd8

Please sign in to comment.