MCPcopy Create free account
hub / github.com/PromtEngineer/localGPT / createSession

Method createSession

src/lib/api.ts:148–168  ·  view source on GitHub ↗
(title: string = 'New Chat', model: string = 'llama3.2:latest')

Source from the content-addressed store, hash-verified

146 }
147
148 async createSession(title: string = 'New Chat', model: string = 'llama3.2:latest'): Promise<ChatSession> {
149 try {
150 const response = await fetch(`${API_BASE_URL}/sessions`, {
151 method: 'POST',
152 headers: {
153 'Content-Type': 'application/json',
154 },
155 body: JSON.stringify({ title, model }),
156 });
157
158 if (!response.ok) {
159 throw new Error(`Failed to create session: ${response.status}`);
160 }
161
162 const data = await response.json();
163 return data.session;
164 } catch (error) {
165 console.error('Create session failed:', error);
166 throw error;
167 }
168 }
169
170 async getSession(sessionId: string): Promise<{ session: ChatSession; messages: ChatMessage[] }> {
171 try {

Callers 4

handleSubmitFunction · 0.80
DemoFunction · 0.80
sendMessageFunction · 0.80
sendMessageFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected